Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting values of element which is going to be deleted? 1

Status
Not open for further replies.

edita

Programmer
Mar 26, 2003
14
PL
Hello,
I'm writing trigger INSTEAD OF DELETE and I want to get values of element which is going to be deleted. How can I retrieve it?

Thanks for help :)
 
In the trigger there is a table named deleted which contains the rows affected by the query causing the trigger to be executed.

e.g.

create trigger ...

...
if exists (select * from deleted where ipk = 4711)
begin
-- do something
end
else
begin
-- do somewhat
end
 
The problem is that I know nothing about any values of this element, so I cannot write condition WHERE... and this element isn't deleted yet. The situation is: user wants to delete an element, but it cannot be done ad hoc, so I need a trigger, which do sth with elements referencing to this one and then delete it.
I hope that now I described it more precisely and I'm still waiting for your help :)
 
Thanks SwampBoogie
Your advice was very helpful, I just needed to change form a little, so my second question is not actual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top