Copy data and update table in MsSQL 2000

mssql-copy-data-logoI try to search around the solution of how to copy and update certain data from table1 to table2. But always cannot remember it and keey search it again and again even I did it several time.

So rather then always search it in Google, I just copy it here to share and keep it as the part of my e-library.

SQL Syntax as below:

SET col2 = t2.col2
FROM table1 t1 inner join table2 t2 on t1.col1=t1.col2
WHERE Col3 >5

What the above SQL did was it copy the certain data in table2 and update to the field table1 base on the search query in the where.

Leave a Reply, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: