RSS Feed

DEFAULT constraint

SQL DEFAULT constraint

A column default is some value or function that the column will take when an INSERT statement doesn't explicitly assign a particular value. In other words, the column default is what the column will get as a value by default.[MSDN]

Example of SQL DEFAULT constraint

The following SQL query creates a DEFAULT constraint on the "Address" column when the "Customers" table is created:

Cust_ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255) DEFAULT '123 L.A US'

No comments:

Post a Comment