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


Please Help Members By Posting Answers For Below Questions

Can you insert NULL in unique column?

826


Differentiate between SQL and ORACLE joins and write their syntax.

775


Explain what are commit and rollback in sql?

674


What is the cartesian product of table?

731


Explain what is dbcc?

779






What are the new features in sql server 2016?

706


What are sub reports and how to create them?

113


According to you what goes into making the best database administrator? : sql server database administration

718


Explain what is public role in sql server?

786


what is the different types of backups available in sql server? : Sql server database administration

645


how can u get last observation in an unknown dataset ?

2179


What are window functions in sql server?

686


What are indexers?

806


What happens when converting big values to numeric data types?

748


How do I find information about the install locations for the various instances running on a computer?

754