What is the use of Default keyword in Sql Server?

 Posted by vishalneeraj-24503 on 1/2/2015 | Category: Sql Server Interview questions | Views: 1422 | Points: 40

Default keyword is used for setting default value to any columns so that whenever any record is inserted in table,that column will also have a value.We do not need to pass column
name in Insert statement.We generally give default value for date related columns,boolean or bit columns where we have Yes and No value and so on.

For Example:-

Test_Id int identity,
Test_Name Nvarchar(50),
Created_Date SmallDatetime default getdate(),
Is_Active bit default 'N'

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response