Updating data from one table to another in sql server
An email from an old college friend landed my mailbox about UPDATE FROM SELECT Statement with Condition:“Hey Pinal,”I have two tables. The requirement was to update Item Price table column Price with US price and for that it required to divide the column by 60.
I want to conditionally update data in one table based on another table. I have included sample scripts and an image for further explanation. ”It always delights to receive email from an old college friend and particularly it is even more interesting when they have a question w where I can help. Here is the sample script of the table displayed in the image.
For any SQL Server Performance Tuning Issue send an email at [email protected]
If it is incorrect, then you can get wrong results.
The reason I am mentioning this is because I have seen people write wrong where clauses and then wondering what went wrong because they specified the correct condition in the SET clause.
The article has includes various methods to copy table from one database to another SQL Server Database.
Each method has been explained in depth with steps to guide users in copying the table’s data easily.