SET other columns to their default value : Update « Insert Delete Update « SQL Server / T-SQL Tutorial






3> CREATE TABLE update_def
4> (
5>     up_id      int          PRIMARY KEY,
6>     up_byname  varchar(30)  NOT NULL DEFAULT SUSER_SNAME()
7>     CHECK (up_byname=SUSER_SNAME())
8>     -- Assume other columns would be here
9> )
10> GO
1>
2> UPDATE update_def
3> SET
6> up_byname=DEFAULT
7> WHERE up_id=1
8> GO

(0 rows affected)
1>
2> drop table update_def;
3> GO








2.5.Update
2.5.1.The syntax of the UPDATE statement
2.5.2.Syntax of UPDATE with a Join
2.5.3.An UPDATE statement that updates all the Billings for a Banker based on the Banker's name
2.5.4.An UPDATE statement that changes the terms of all Billings for Bankers in three states
2.5.5.Limiting Rows to Be Updated
2.5.6.Assigning Update Values Using Subqueries
2.5.7.An UPDATE statement that uses an arithmetic expression to assign a value to a column
2.5.8.Updating using two subqueries.
2.5.9.Updating Data Using the CASE Expression
2.5.10.An UPDATE statement that assigns the maximum due date in the table to a specific Billing
2.5.11.Violating the constraint in an update statement
2.5.12.SET other columns to their default value
2.5.13.Change the phone number of authors living in Gary, IN, back to the DEFAULT value
2.5.14.An UPDATE statement with top
2.5.15.Update table in a transaction
2.5.16.Updating Large Value Data Type Columns with WRITE