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
Can you insert NULL in unique column?
Differentiate between SQL and ORACLE joins and write their syntax.
Explain what are commit and rollback in sql?
What is the cartesian product of table?
Explain what is dbcc?
What are the new features in sql server 2016?
What are sub reports and how to create them?
According to you what goes into making the best database administrator? : sql server database administration
Explain what is public role in sql server?
what is the different types of backups available in sql server? : Sql server database administration
how can u get last observation in an unknown dataset ?
What are window functions in sql server?
What are indexers?
What happens when converting big values to numeric data types?
How do I find information about the install locations for the various instances running on a computer?