Tech Sharing

Tech Sharing

Advertisement

Copy data and update table in MsSQL 2000

By on January 20, 2009

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:

UPDATE t1
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.


Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Comments

No Responses to “Copy data and update table in MsSQL 2000”

Write a Comment

Captcha * Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: