How to create a trigger for insert only?



How to create a trigger for insert only?..

Answer / Payal Agrawal

"To create an INSERT-only trigger in MS SQL Server, you can use the `CREATE TRIGGER` command. Here is an example:nn```sqlnCREATE TRIGGER tr_InsertOnly ON [table_name]nAFTER INSERTnASnBEGINnIF EXISTS(SELECT * FROM inserted)nBEGINn-- Your code to perform operations based on the inserted datanENDnEND;n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What are partitioned views?

1 Answers  


what's new in sql server 2016?

1 Answers  


What are difference between Cluster index and Non-Cluster index?

1 Answers   QuestPond,


How to provide default values to stored procedure parameters?

1 Answers  


What is a table called, if it has neither cluster nor non-cluster index? What is it used for?

1 Answers  


How to set database to be single_user in ms sql server?

1 Answers  


What is normalization and denormalization in sql server?

1 Answers  


What is a system database and what is a user database?

1 Answers  


How can you append an identity column to a temporary table?

0 Answers  


What is data source object?

1 Answers  


what's the difference between delete table and truncate table commands? : Sql server database administration

1 Answers  


employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 6 6 7 here the values r repeated two times.how to select the repeated values only.i.e 3,5,6 should alone come.

3 Answers  


Categories