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
You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?
What is the use of toad or sqldbx.?
Can a unique index be created on a column, which contains null?
What is the difference between stored procedure and functions?
What is store procedure? How do they work?
What is service broker?
What are clustered and non-clustered index?
Explain datetimeoffset data type in sal server 2008?
What is user-defined functions? What are the types of user-defined functions that can be created?
How to truncate the log in sql server 2012? : sql server database administration
How to filter out duplications in the returning rows in ms sql server?
How to create a dynamic cursor with the dynamic option?
What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture
How to get a list of columns in a view using the "sp_help" stored procedure?
Explain syntax for dropping triggers?