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
 Triggers

Author  Topic 

Pete_N
Posting Yak Master

181 Posts

Posted - 2013-08-01 : 05:10:46
SQL2008 R2

I have created a trigger ( After Insert ) on db1.table 1 that executes a stored procedure on DB2.Table 1
Both db's are on the same SQL Server yet the trigger is not firing. ( it's a very simple trigger for testing ) I am presuming that its a security issue, so my question is, who is firing the trigger, Si is the SQL Agent or the logon of who inserted the record ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-01 : 05:13:32
when you say trigger is not firing is it that its throwing some error? Did you check this by manually inserting some values? Also was the actual operation normal insert or BULK INSERT? If latter, then by default triggers wont be fired unless you explicitly set FIRE_TRIGGERS to true.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-08-01 : 05:13:57
The trigger is run within the same statement as originally run and executes the trigger.
Do you get any error messages?



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

Pete_N
Posting Yak Master

181 Posts

Posted - 2013-08-01 : 05:28:26
the trigger is a after insert trigger on a table that a web appliction writes to. The trigger fires a stored procedure on a different database.

when the trigger is enabled, The web application does not insert the record, but as soon as the trigger is disabled it works fine.

If I use Management studio to insert a record the trigger fires, its only when the web application inserts the record, hence I think its a security issue
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-01 : 05:30:26
whats the login application uses? does it have required execute permissions on stored procedure which trigger calls?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -