To change the value of a column in a particular row of a table, you can use the T-SQL UPDATE statement. The syntax is straightforward: The UPDATE command is followed immediately by the table name, then by the SET keyword, which specifies which column or columns will be updated. If the SET keyword specifies multiple columns, you separate the column names with commas.

Like the DELETE statement, which I described in "Using the DELETE Statement." The T-SQL UPDATE statement is set-oriented, so you need to use it very carefully. For example, the statement

UPDATE MyTable SET ColumnData = 'All Values'

would change the value of the ColumnData column to All Values for every row in the table named MyTable. But you'd probably never want to change the value of a column for every row of a table--unqualified UPDATEs are typically used only for mass-maintenance operations.

Consequently, your code should almost always indicate specifically which rows you want to update. Applications typically use the WHERE clause to identify the row or rows that will be updated. For instance, you'd use the code

UPDATE MyTable SET ColumnData = 'One Value', ColumnDate = GETDATE()
WHERE ColumnID = 1

to modify the values in the ColumnData and ColumnDate columns for the row whose ColumnID column is equal to 1.