Limiting Updated Data by Using the WHERE Clause

The WHERE clause performs the following functions:

  • Specifies the rows to be updated.

  • Indicates the rows from the source tables that qualify to supply values for the update if a FROM clause is also specified.

If no WHERE clause is specified all rows in the table are updated.

The following example implements a name change for one of the names in the SalesReason table. The WHERE clause limits the rows to be updated to those that contain the name Other.

UPDATE AdventureWorks2008R2.Sales.SalesReason
SET Name = N'Unknown'
WHERE Name = N'Other';