Hi, I am new to SQL server and I have what I think is probably an easy question. I have table1 that has a long var char and a unique ID. I want to create another table (table2) that has a matching unique ID for the first table and then column(s) of data that defines how the long var char should get sliced up into fields. Then I want a way (stored procedure?) to read the data out of table1, apply the structure/definition from table2 and insert it into a third table. I need to do it quickly and efficiently of course, but I dont know where to start!
So, to put it simply, heres table1:
1|pam,mitchell,female,28,hotty<lf>
2|doug,roberts,male,50,jerk<lf>
How do I store the data definition in table2 and then how do I apply it and insert the translated records to table3 to get this:
pam|mitchel|female|28|hotty
doug|roberts|male|50|jerk
I know I rambled on with this and probably could have explained better, but the white out on my screen keeps slowing me down :]
Thanks ahead of time!Come on! Somebody help me pleaseeeeeeee!!!!
Originally posted by CuteSmartChic
Hi, I am new to SQL server and I have what I think is probably an easy question. I have table1 that has a long var char and a unique ID. I want to create another table (table2) that has a matching unique ID for the first table and then column(s) of data that defines how the long var char should get sliced up into fields. Then I want a way (stored procedure?) to read the data out of table1, apply the structure/definition from table2 and insert it into a third table. I need to do it quickly and efficiently of course, but I dont know where to start!
So, to put it simply, heres table1:
1|pam,mitchell,female,28,hotty<lf>
2|doug,roberts,male,50,jerk<lf>
How do I store the data definition in table2 and then how do I apply it and insert the translated records to table3 to get this:
pam|mitchel|female|28|hotty
doug|roberts|male|50|jerk
I know I rambled on with this and probably could have explained better, but the white out on my screen keeps slowing me down :]
Thanks ahead of time!|||Create a SP, read the records one by one using cursor, and then parse the string by the format definition.
Anotherway is to dump the data into a text file and import them by DTS.|||uh cutesmartchic?
since you are trying to get help based on how cute you are, ill gladly help you.
WHEN I SEE YOUR PICTURE!!
ps- im a sql developer, 4 years|||If you're only doing this once, using enterprise manager, right click on table1, export the data to table 2, right click on table 2 and go into proporties and change any field you like. When using the import/export feature on enterprise manager, you can save it as a DTS package which can be run later. Hope this helps. Bernie B.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment