Top Menu

Search This Blog

SQL Constraints(DEFAULT)

The DEFAULT Constraints is used to add a default value in a table columns.

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

CREATE TABLE CANDIDATE
 (
   CandidateId int IDENTITY(1,1) PRIMARY KEY,
   CandidateNumber int NOT NULL UNIQUE,
   LastName varchar(50) NOT NULL DEFAULT '12345',
   FirstName varchar(50) NOT NULL,
   PostCode int NULL,
   Address varchar(50) NULL,
   Phone varchar(50) NULL,
)


Set DEFAULT  values in the MS-SQL Server Designer Tools:
Select the column and go into the “Column Properties”


Post a Comment

Designed by OddThemes | Distributed By Gooyaabi Templates