Updating data from one table to another in sql

If you incorrectly specify your search condition you might update too many rows, or not enough rows.Additionally if you forget the WHERE clause altogether, you will update the entire table when you might not intend to.Here is an example where I specified the WHERE clause incorrectly and I updated too many rows: Here I updated Toy Name on two rows, the “Silver Magic” and the “Super Surfer” Toyname rows.

In my first TSQL script above, when I create the TOY table, there is typo in the first Toy Name.

In order to update a row in a SQL Server table you will use the UDPATE statement.

In this article I will show you a number of different ways to use the UPDATE statement to modify the data in your SQL Server tables.

Update queries are the most efficient way to make bulk changes to data; they are much more efficient than using a recordset in a VBA procedure.

If you are an application programmer then you will more than likely need to write TSQL code to update your SQL Server database tables.

Leave a Reply