September 20, 2008 at 4:03 pm
Hi i'm looking for the best way to migrate data from an old table with column1,column2,column3 and insert the data from those columns into column1 in my new table.
the tables aren't too huge, 10,000 records.
September 20, 2008 at 6:23 pm
To help those who can help you.... please follow the posting protocol as covered by the article in my signature block.. Thanks
September 20, 2008 at 6:29 pm
i don't have anything else to post.
i'm not asking to be spoon fed, just a suggested best stratgey i'll google myself from there.
September 20, 2008 at 6:30 pm
you can try below one if data types of all columns(col1,col2, ___) in old table are same and in new table column is in varchar:
"insert into testcon select convert(varchar(20),col1)+convert(varchar(20),col2)+convert(varchar(20),col3) from con"
Thank You.
Regards,
Raghavender Chavva
September 20, 2008 at 6:34 pm
datatypes are all the same anyway. think reverse pivot.
September 20, 2008 at 7:49 pm
i don't have anything else to post.
i'm not asking to be spoon fed, just a suggested best stratgey i'll google myself from there
A ha so you did post some more information.
datatypes are all the same anyway. think reverse pivot.
Almost all members try to be helpful ... If you continue thinking as you have why not go Google...........INSERT INTO and / or SELECT INTO
September 21, 2008 at 9:54 am
tksmith (9/20/2008)
Hi i'm looking for the best way to migrate data from an old table with column1,column2,column3 and insert the data from those columns into column1 in my new table.the tables aren't too huge, 10,000 records.
INSERT INTO NewTable(Col1)
SELECT Col1 from OldTable UNION ALL
SELECT Col2 from OldTable UNION ALL
SELECT Col3 from OldTable
--Jeff Moden
Change is inevitable... Change for the better is not.
September 21, 2008 at 9:56 am
bitbucket (9/20/2008)
To help those who can help you.... please follow the posting protocol as covered by the article in my signature block.. Thanks
BitBucket... you can turn that link into a clickable link by putting it between (url)(/url) IFCode shortcuts. Notice that you should replace the parenthesis with square brackets.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 21, 2008 at 4:33 pm
Jeff Moden (9/21/2008)
tksmith (9/20/2008)
Hi i'm looking for the best way to migrate data from an old table with column1,column2,column3 and insert the data from those columns into column1 in my new table.the tables aren't too huge, 10,000 records.
INSERT INTO NewTable(Col1)
SELECT Col1 from OldTable UNION ALL
SELECT Col2 from OldTable UNION ALL
SELECT Col3 from OldTable
thanks jeff that worked a treat - i was messing around with unpivot and it just wasn't happening. union is a much simply approach.
September 21, 2008 at 5:30 pm
Perfect. Thanks for the feedback, Tk...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply