Tuesday, February 21, 2012

Running SP with a different user

We are using SQL2000. User insert table in one database DB1 and trigger insert the record into another database DB2. In this scenario, is it possible have a trigger in DB1 to execute a stored procedure in DB2 with a different user?

try define trigger with execute as clause

CREATE TRIGGER YourNAme ON Yourtable
WITH EXECUTE AS 'CompanyDomain\SqlUser1'
AFTER INSERT, UPDATE AS.......
--call your procedure here
GO

No comments:

Post a Comment