Thursday, 28 March 2013

Implement Data Integrity in Sql Server


create table (TabelName)(
 RegNo int constraint pkey primary key,
 StuID int unique,
 SName char (20),
 sAge int constraint chage check (sage between 15 and 25),
 sCity char(20)check(scity in ('jaipur','kota')),
 sphone char (12)check (sphone like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'),
 sstate char (20) default 'Rajasthan'
 )
Select * from (TableName)