hi
this is ramamoorthy i need a help how to implement trigger in sqlserver
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Aug 2, 2007, 5:56 AM
It's very simple to create trigger. Trigger automatically fires when u perform any operations(insert,update and delete) on the table. Here i am writing one sample trigger for delete.
CREATE TRIGGER MySample ON [TableName] FOR DELETE AS IF (SELECT state FROM deleted) = ‘AnyValue’ BEGIN PRINT ‘Can not remove customers from AnyValur' PRINT ‘Transaction has been canceled’ ROLLBACK END