adspace


How to create a trigger for insert only?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

If any stored procedure is encrypted, then can we see its definition in activity monitor?

1073


Can one drop a column from a table?

1091


You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?

1216


do you know how to configure db2 side of the application? : Sql server database administration

1125


What is the difference between upgrade and migration in sql server?

1185


Disadvantages of the indexes?

1225


What is sql or structured query language?

1228


Can sql servers link to other servers like oracle?

919


What are the different SQL Server Versions you have worked on?

1080


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

1048


What is subquery? Explain the properties of a subquery?

1063


What is temporary table in sql server? Why we use temp table?

1023


What is in place upgrade in sql server?

1127


What are wait types?

1251


What is standby servers? Explain types of standby servers.

1081