January 12, 2011 at 10:03 pm
Hi All,
I have a table with frequent update by 2 sources.
One is by front end application user(webuser) he will update records
and another one is batch job which runs with other user name(sam) updates dially.
I need to have update trigger to fire (Update trigger will update the self table flag to indicate this update has done by webuser) only when update done by webuser not the batch job.
How do we do this in SQL server 2005 ?
Thanks,
Gangadhara MS
SQL Developer and DBA
January 13, 2011 at 8:11 am
An update trigger will always fire when the table is updated. That is the nature of triggers.
If you want to control the behavior of the trigger based on userid, then you need to do that within the trigger itself. You can use IF statements or WHERE clauses to do this. For example,
IF user_name() = 'webuser'
BEGIN
<Your code here>
END
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply