The DEFAULT CONSTRAINT is used for default value, when the insert statement does not provide any specific value. DEFAULT CONSTRAINT are special case of column default.It is also used when we use any scripting code for the SQL Database.
Step2:- Create DEFAULT constraint on existing column.
There are some steps to Know about DEFAULT CONSTRAINT Which are given below:-
Step1:- Create table and apply the DEFAULT constraint on column.
Step1:- Create table and apply the DEFAULT constraint on column.
create table student1(id int, name char(20),city char(30)constraint def default 'delhi')
Step2:- Create DEFAULT constraint on existing column.
alter table student1 add constraint def1 default 'india' for city
Step3:- Insert the data in student1 table.
insert into student1 values(101,'rajesh','india')
Step4:- Drop the constraint from the table.
alter table student1 drop constraint def
SEE IT:-
For More:-
- Microsoft Sql Server
- Create Table Without Command
- Check constraints
- File Handling Real Application
- Add Identity Column
- Copy Data from one table to another table
- Stored Procedure
To Get the Latest Free Updates Subscribe
Click below to download whole command file.
DOWNLOAD
0 comments:
Post a Comment