Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger problem
Message
 
To
26/03/2009 16:20:51
John Deupree
Long Term Care Authority
Tulsa, Oklahoma, United States
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01391619
Message ID:
01391792
Views:
58
>>>I can do it in the UI, but I thought it would be better to keep it in the DB code. I might rethink that, though.
>>>>
>>>>Can you UPDATE cs_enddate field from somewhere else?
>>
>>No I ask because IF you didn't change anywhere cs_enddate but from the DELETE trigger you could use that as a check to see from where that triggers is fired.
>
>No, it's the update trigger normally fires from changes made through the UI. How do you check to see from where the trigger is fired?



IF you didn't change cs_enddate from anywhere else but from DELETE trigger you could do this in UPDATE Trigger:
IF EXISTS(SELECT 1 FROM INSERTED INNER JOIN DELETED ON Inserted.cs_enddate <> Deleted.cs_enddate)
   BEGIN
      --- cs_enddate is updated that means the trigger is fired from DELETE triger
      RETURN
   END
.....

But as Isaid, that is VALID only if you didn't change cs_enddate anywhere else but DELETE trigger.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform