Updating entire tables using update query


02-Aug-2016 03:37

Below is an example that does this: I updated the Toy Name and the Price for the Toy row with an ID value of 4, which was my original Super Surfer row.

I did this by having a single SET clause in my UPDATE statement, with the two column name/value pairs separated with a comma.

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.

By doing this I can see what my WHERE condition will return to make sure it identifies the same rows I want to update.

To accomplish that I joined the TOY table to my New Toy Price table based on the ID column.

If you want to review the complete syntax of the UPDATE statement then please refer to Books Online.

To properly show you how to use the UPDATE statement I will need to create a few tables to hold some sample data. Below is the code to create my Toy table: In order to show you how to UPDATE a table from data in another table I need to build a second sample data table that I will call New Toy Price.

In this article I will show you the most common methods of using the UPDATE statement.

Below is the basic syntax for the UPDATE statement: This is not the complete syntax of the update 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.



It is incredible that analysts have not challenged Sheffield’s claim over the last two years that the Spraberry is second only to the Ghawar Field (Saudi Arabia) as the world’s largest oil field. It’s Not A Lie If We Tell You It Is A Lie Companies like EOG and Pioneer get away with making misleading claims by carefully choosing their words and by explaining that what they just said was technically untrue. A reserve is a volume of oil or gas that is commercially producible at a specific current price.… continue reading »


Read more

(We're just checking to see if you're reading carefully.… continue reading »


Read more

What if I tell you that nowadays, some of most beauties that you see in the fashion parade, serving your coffee at the bar, walking in the streets fresh and graceful, could be not what they seem? The story is, whoever you are, you should never lose the hopes.… continue reading »


Read more

By no means do I advocate using the pill in marriage if it is against your beliefs.… continue reading »


Read more

The beauty in is that they guarantee you will never have to see another random dude’s jock again.… continue reading »


Read more