Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trigger on user basis

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2011-01-12 : 23:57:18
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

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-13 : 08:49:23
Use SYSTEM_USER, HOST_NAME, or APP_NAME in your trigger.

Execute this query to see what I mean
select SYSTEM_USER, host_name(), APP_NAME(), user_name()
Go to Top of Page
   

- Advertisement -