--check constraint it set's the particular condition until
--unless it is fulfill the record will not entered into the database
CREATE TABLE user2
(
id INT IDENTITY(1, 1),
name1 VARCHAR(20) CHECK (name1 LIKE '[%t%]'),
--checking name enter in database Should start from T
salary INT CHECK (salary>2000)
--Checking No Employee should get salary less than 2000
)
INSERT INTO user2
VALUES ('ramabo',
1000) -- will throw an execption as we made filter our database with check condition
INSERT INTO user2
VALUES ('t',
23000)
SELECT * FROM user2
Listen to Your Daily Tune's
Sunday, September 19, 2010
Check Constraint Sql Server 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment