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
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?
can an automatic recovery be initiated by a user? : Sql server administration
Does partitioning improve performance sql server?
What is the difference between value type and reference type?
How do you troubleshoot errors in a SQL Server Agent Job?
Explain sql server service broker?
What is save transaction and save point?
how can u get last observation in an unknown dataset ?
How to edit table in sql server 2017?
How do we upgrade from SQL Server 6.5 to 7.0 and 7.0 to 2000?
Do you know what are the reporting services components?
Which database stores information about replication?
Tell me what is the significance of null value and why should we avoid permitting null values?
How to provide login information for a new odbc dsn?
Can we install sql server 2016 on windows 7?