Database - DEFAULT Constraint & RULE Constraint
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.
The rule
constraint is
used to insert
only a specified range of
values into a column.
create table test1(id int constraint
pk_test primary key,sname varchar(50))
select *from test1
create rule r_test
as @range between 100 and 1000
sp_bindrule r_test,'test1.id'
insert into test1 values(101,'siva')
sp_unbindrule 'test1.id'
drop rule r_test
Comments
Post a Comment