Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Copying from one column to another?

Author  Topic 

fazsnatch
Starting Member

4 Posts

Posted - 2012-06-18 : 05:37:38
Hello,

I am trying to copy data from column in a table to another column in a table. The second table already contains some data but the data i get from the first column should hopefully overwrite it.

I am still learning being a newbie :D and wondering what code can be used to simply copy data from the table and then add it into this table.

Thank you

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-18 : 05:42:06
Are they in the same table?
If not what is the join condition?

update tale2
set col1 = t2.col2
from table2 t2
join table1 t1
on t1.colpk = t2.colpk

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -