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 / mohan

create table #test (sno int check(sno in(1,2,3)))

successfull statement:
insert into #test values(3)

failure statement :

insert into #test values(4)
error message:
INSERT statement conflicted with COLUMN CHECK
constraint 'CK__#test__sno__68E599B5'. The conflict
occurred in database 'tempdb',
table '#test________________________________________________
____________________________________________________________
___00000000D7E0', column 'sno'.
The statement has been terminated.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?

664


How do triggers work?

692


What are the hotfixes and patches in sql server?

747


Why use view instead of a table?

708


What are types of storage modes? : sql server analysis services, ssas

772






How you would rewrite the sql query to return the customerid sorted numerically?

755


How to access the deleted record of an event?

743


What is a virtual table in sql?

712


How to drop existing indexes in ms sql server?

755


What is raid, and how it can influence database performance?

760


What is a covering index?

719


How to rebuild indexes with alter index ... Rebuild?

770


How to check if a table is being used in sql server?

686


How can you check the version of sql server?

775


What is difference between delete and truncate commands?

693