Changing 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 AdventureWorks.Sales.SalesReason
SET Name = N'Unknown'
WHERE Name = N'Other';

See Also

Concepts

Changing Data by Using the SET Clause
Changing Data by Using the FROM Clause
Limiting Updated Data by Using TOP
Changing Data by Using UPDATE

Other Resources

UPDATE (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance