Sql updating table from same table

Rated 4.68/5 based on 725 customer reviews

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

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

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

This is when you need to know how to use the UPDATE statement to update those rows.

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.

I can do that with the following code: In this code I updated the Toy table based on values in another table, in this case a table named New Toy Price.

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

Leave a Reply