Skip to content
Advertisement

How to copy column from one table into another table in SQL Server

I want to copy column state_name from table state into table district. here is my query.

This code is working on mysql but not in SQL Server

enter image description here

This is the state table

enter image description here

This is the district table

Advertisement

Answer

In SQL Server, the corresponding syntax might be:

This is more commonly written using an explicit JOIN:

However, you probably shouldn’t be updating the value at all. Just use a JOIN to get the state name when you need it.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement