TRIGGER Permissions- quick clarification

Last Post 06 Dec 2010 01:38 PM by gunneyk. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SQL_Jr
New Member
New Member

--
06 Dec 2010 09:31 AM
Drawing a blank all of the sudden.  Quick refresher.  I have a user with access to DB1 and on insert, a trigger is executed to insert data into DB2.table.  What permissions are needed for the update?  Under what context/user does the trigger update the table in DB2?  Please advise...  Thx
gunneyk
New Member
New Member

--
06 Dec 2010 10:07 AM
By default the trigger is always under the user that initiated the triggers permissions. Have a look in BOL under Trigger - Security for more details.
SQL_Jr
New Member
New Member

--
06 Dec 2010 11:18 AM
Thanks.   So, the initiating user would need to have explicit permissions to the tables being update/inserted/etc?
What if I have in my trigger create: EXECUTE AS LOGIN = 'sa' - would that  work
gunneyk
New Member
New Member

--
06 Dec 2010 01:38 PM
Well that would certainly work but a bit overkill don't you think. You should only ever give the minimum permissions you need to get the task accomplished.
You are not authorized to post a reply.

Acceptable Use Policy