SQL Server Performance Forum – Threads Archive
Need your advice please
Hi,I have a question please in a AFTER INSERT,UPDATE trigger.
Can this trigger have delete statement in it.
what i am trying to do is what ever happens in table A need to be captured in history table B
But when there is a status change ("DeAllocated" ) in table A then it needs to insert this row in table B and then Delete this row in table A.
Will it be ok to write this Delete part in the same trigger.
Thank you,
Mattie
You can use an INSTEAD OF trigger to do this.
quote:Originally posted by Mattie_Bala69
Hi,
I have a question please in a AFTER INSERT,UPDATE trigger.
Can this trigger have delete statement in it.
what i am trying to do is what ever happens in table A need to be captured in history table B
But when there is a status change ("DeAllocated" ) in table A then it needs to insert this row in table B and then Delete this row in table A.
Will it be ok to write this Delete part in the same trigger.
Thank you,
Mattie
I have a question please in a AFTER INSERT,UPDATE trigger.
Can this trigger have delete statement in it.
what i am trying to do is what ever happens in table A need to be captured in history table B
But when there is a status change ("DeAllocated" ) in table A then it needs to insert this row in table B and then Delete this row in table A.
Will it be ok to write this Delete part in the same trigger.
Thank you,
Mattie
Yes. I don’t see why not.
KH
]]>