Click here to Skip to main content
16,013,082 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have created a database but i am facing a situation where i need to create based on the following condition


1) zero records allowed
2) 14 records allowed
ie) no of records has to be equal to zero or 14


how to create such a database
thanks in advance
Posted
Comments
Saral S Stalin 31-Mar-12 12:12pm    
Do you mean to say, you created a table, which has a column that should accept only 0 or 14 as values? You can acheive this with a check constraint or a trigger.
mohanrajkiller 31-Mar-12 13:58pm    
i am not specifying the value of a column ,i mean the records in the table

Create an INSTEAD OF INSERT trigger, if the number of records in the INSERTED table is equal to 14 then only do the INSERTION.

See http://msdn.microsoft.com/en-us/library/ms175089.aspx[^] for more information about this trigger
 
Share this answer
 
i am not getting you, what you trying to say, i need to know.
 
Share this answer
 
Comments
Saral S Stalin 31-Mar-12 12:13pm    
not an answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900