Changing Data by Using UPDATE
The UPDATE statement can change data values in single rows, groups of rows, or all the rows in a table or view. It can also be used to update rows in a remote server by using either a linked server name or the OPENROWSET, OPENDATASOURCE, and OPENQUERY functions, as long as the OLE DB provider used to access the remote server supports updates. An UPDATE statement referencing a table or view can change the data in only one base table at a time.
The UPDATE statement has the following major clauses:
Contains a comma-separated list of the columns to be updated and the new value for each column, in the form column_name = expression. The value supplied by the expressions includes items such as constants, values selected from a column in another table or view, or values calculated by a complex expression. For more information, see Specifying Data Columns by Using the SET Clause.
Identifies the tables or views that supply the values for the expressions in the SET clause, and optional join conditions between the source tables or views. For more information, see Specifying the Data Source by Using the FROM Clause.
Specifies the search condition that defines the rows from the source tables and views that qualify to provide values to the expressions in the SET clause. For more information, see Limiting Updated Data by Using the WHERE Clause.
The following example uses the UPDATE statement to increase the price of all the products associated with product model 37 by 10 percent:
To change data using UPDATE