April 23, 2009 at 3:02 am
The separtaion must be s/o (or) w/o (fathername), wap (or) pap (or) yap (RationCardNo)
1) It had total one string means In one string more than one owner,father name, rationcardno(may be or may not be) comes
2) In a string First Ownername(Aakula Anjaiah) second one is father name(S/o Veeraiah) and third one is RationCardno(Wap 6825011205) and again follows owner name/father name/rationcardno
Table:Temp
SID OwnerName/FatherName/RationCardnO
S001 Aakula Anjaiah S/o Veeraiah Wap 6825011205 Aakula
Sada Nandam S/o Veeraiah Aakula Veeraiah S/o Bhumaiah Wap
Aakula Shivadeenam S/o Veeraiah Wap 7825011257
S002 Sayad Ajimuddin S/o Bhasumiya Wap 6825010014 Shaik
Shassina Begam W/o Moulana Wap 1883913037 Syed Alina
W/o Bhasu Wap 883910321 Syed Nabhi S/o Bhasu Syed
Mahaboob Ali S/o Bhasu Wap 3839130147 Syed Ali
S/o Bhasumiya
I had Temp Table with one column as OwnerName/FatherName/RationCardnO
I want to insert above values into 4 fields of Temp1 table
my Temp1 table as 4 columns
SID
OwnerName
FatherName
RationCardNo
Plz give me a query to insert
April 23, 2009 at 5:06 am
I may be mis-understanding the question, but INSERT is really well explained in Books On Line;
if the table exists, it simply
INSERT INTO TABLENAME(columnList)
select columnlist from someTable
to create thetable "on the fly", straight from the select, it's
SELECT columnlist
INTO NEWTABLENAME
FROM SOMETABLE
I'm assuming you are new to TSQL and are not yet comfortable with the INSERT command; what have you tried so far?
Lowell
April 23, 2009 at 6:00 am
I think you have posted a topic regarding same earlier also. Please continue the same topic, as both seems related.
The separtaion must be s/o (or) w/o (fathername), wap (or) pap (or) yap (RationCardNo)
1) It had total one string means In one string more than one owner,father name, rationcardno(may be or may not be) comes
2) In a string First Ownername(Aakula Anjaiah) second one is father name(S/o Veeraiah) and third one is RationCardno(Wap 6825011205) and again follows owner name/father name/rationcardno
Your column data are still not in position to separate on any solid bases.
for example, in below line
S001 Aakula Anjaiah S/o Veeraiah Wap 6825011205 Aakula
Sada Nandam S/o Veeraiah Aakula Veeraiah S/o Bhumaiah Wap
Aakula Shivadeenam S/o Veeraiah Wap 7825011257
record-1
owner name: Aakula Anjaiah
separated by: S/o
father name: Veeraiah
separated by: Wap
RationCardno: 6825011205
record-2
owner name: Aakula Sada Nandam
separated by: S/o
father name: Veeraiah Aakula Veeraiah (???????????)
Now,
1) There isnt any separation for now record after RationCardNo, OR you might consider the single word for Rationcardno.
2) Look in record-2. You cannot separate father name and the end of record.
So, I strongly feel that you have to change the string in your column, and add some character to separate the individual record OR change your table/application structure to insert data.
"Don't limit your challenges, challenge your limits"
April 23, 2009 at 6:33 am
Thanks to kruti's insight, i think i see your problem.
your datasource makes no sense to anyone, so noone can really help.
I'm assuming that this is a list of names/family members, with one SID per family.
your data is not in any standard format, so it's gotta be cleaned up before anyone can offer any suggestions;
what does S/o w/o mean, for example? why do some people have a RationCardNo and others do not?
look at the way i formatted this? is this how the one SID should really be if it were a table? see how there are holes/missing fields if the data is formatted out this way?
you've got to get teh data into a REAL table structure (CREATE TABLE ...) complete with the insert statements in order for us to be able to help and interpret your quesiton.
SID OwnerName FatherName RationCardNo
S001 Aakula Anjaiah S/o Veeraiah Wap 6825011205
Aakula Sada Nandam S/o Veeraiah Aakula Veeraiah
S/o Bhumaiah Wap
Aakula Shivadeenam S/o Veeraiah Wap 7825011257
S002 Sayad Ajimuddin S/o Bhasumiya Wap 6825010014
Shaik Shassina Begam W/o Moulana Wap 1883913037
Syed Alina W/o Bhasu Wap 883910321
Syed Nabhi S/o Bhasu Syed
Mahaboob Ali S/o Bhasu Wap 3839130147
Syed Ali S/o Bhasumiya
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply