DEFAULT Constraint – Adding Column Defaulting in Sql Server Table

The DEFAULT constraint is used to insert a default value into a column.

The default value will be added to all new records, if no other value is specified.

Rather than providing a value into a column manually during insert operation, by using default option we can auto-populate specific value and update in column.

in the below example, no need to provide CreatedDate and Freezed values during Insertion .

Example :

create table TestTable
UserId int,


CreatedDate datetime default (getdate()),
Freezed int default (0)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s