How can i give the restrictions for the data entry, if i
wish to enter only I ,II, III, IV in the grade actegory of
student table?
Answer Posted / soorai ganesh
If u Use SQLSERVER 2005. This will helpful to you
CREATE RULE myRule AS @strGrade IN('I','II','III','IV')
GO
CREATE TABLE myTable
(
empID INT,
empName VARCHAR(50),
empGrade VARCHAR(3),
empSalary NUMERIC(9,2)
);
GO
sp_bindrule myRule, 'myTable.empGrade';
GO
INSERT INTO myTable VALUES(1,'Ganesh','I',59000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','II',89000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','III',99000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','IV',259000) -- Valid
INSERT INTO myTable VALUES(1,'Ganesh','V',259000) --
Invalid
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
Explain trigger and trigger types?
Write an sql query to find first weekday of the month?
Can we update data in a view?
Can primary key be a foreign key?
What is the library index called?
Explain magic tables in sql server?
How to set the current database in ms sql server?
What new changes are being made in SQL Server?
How to use "if ... Else if ... Else ..." Statement structures in ms sql server?
Benefits of Stored Procedures?
what is raid and what are different types of raid configurations? : Sql server database administration
What are the different types of columns types constraints in the sql server?
what is checksum in sql server.........???
What are unicode character string data types in ms sql server?
What does null mean?