UPDATE (Searched)

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

UPDATE (Searched)

The UPDATE (Searched) statement changes data in existing rows of a table. UPDATE (Searched) is a standard Transact-SQL statement.


UPDATE {table_name | view_name} SET [table_name. | view_name.] {column_name={expression | NULL | (select_statement)}[,...]} [FROM {table_name | view_name}[,...]] [WHERE search_condition]



Is the table to be updated.


Is the view to be updated.


Is the column to be updated.


Is the value of a particular column. This value must be an expression.


Is a valid SELECT statement that returns a single row with a single column of data.


Is any expression that can legally follow the standard Transact-SQL WHERE clause.


Use UPDATE to change values. Use INSERT to add new rows.

Updating a varchar or text column with the empty string (' ') inserts a single space. All char columns are padded to the defined length.

All trailing spaces are removed from varchar column data. Strings that contain only spaces are truncated to a single space.

The SQL batch size of 128 KB limits the maximum amount of data that you can alter with UPDATE. Because some memory is required for the query's execution plan, the actual amount of data you can include in an UPDATE statement is somewhat less than 128 KB. For example, you can update one column of about 125 KB, or two columns of about 60 KB each.

UPDATE authors SET au_fname = 'Fred' WHERE au_lname = 'White'

See Also