Collections:
DEFAULT - Using Column Default Values in INSERT Statements in SQL Server
How To Use Column Default Values in INSERT Statements in SQL Server?
✍: FYIcenter.com
If a column is defined with a default value in a table, you can use the key word DEFAULT in the INSERT statement to take the default value for that column. The following tutorial exercise gives a good example:
INSERT INTO fyi_links VALUES (102, 'dba.fyicenter.com', NULL, 0, DEFAULT) GO (1 row(s) affected) SELECT * FROM fyi_links GO id url notes counts created 101 dev.fyicenter.com NULL 0 2006-04-30 102 dba.fyicenter.com NULL 0 2007-05-19
The default value, getdate(), is used for "created" column, which gives the current date.
2016-11-03, 731👍, 0💬
Popular Posts:
How To Recreate an Existing Index in SQL Server? If you want to change the definition of an existing...
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
What Happens to Your Transactions When ERROR 1213 Occurred in MySQL? If your transaction receives th...
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...