>>> Programming >> MSSQL > SQL How to update a table with values from another table? (This page has been seen 502 times)
SQL How to update a table with values from another table?
Lets say you have created a table and want to copy some data from a table to
your new table, you could do something like this.
UPDATE T
SET Field1 = c.Field1
, Field2 = c.Field2
, Field3 = c.Field3
, Field4 = c.Field4
, Field5 = c.Field5
FROM MyTable T
JOIN MyTable2 C
ON T.ID = C.ID
UPDATE T
SET Field1 = c.Field1
, Field2 = c.Field2
, Field3 = c.Field3
, Field4 = c.Field4
, Field5 = c.Field5
FROM MyTable T
JOIN MyTable2 C
ON T.ID = C.ID
Like
Dislike
Advertisement by Google
Comment:
Code Language:
Code:
Here you can paste a code example. It will then be processed by SyntaxHighlighter and formatted for easier readability.
Please remember to select the correct Code Language in the select above so the SyntaxHighlighter can highlight the code properly.
Code:
Please enter the code you see above
What is 1 + 4 =