All we need is to create several pre-insert/update triggers in SQL Server 2008 R2 which do some select * or select count(*) and explicitly fail if it is empty or non-empty.
Please, how to achieve that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create an
INSTEAD OF INSERT, UPDATEtrigger. Now to prevent DML you have 2 options. In the body of trigger executeRAISERRORso your application can catch the error. Another way is not to perform actualinsert/updatein the trigger, so no records will be inserted/updated, but the user will not know if DML succeeds.