Link to home
Start Free TrialLog in
Avatar of heyday2004
heyday2004

asked on

Stored procedure failed because of "WITH EXECUTE AS SELF" ?

I have a storec procedure, doing some kind of cross database queries, create temp tables, and populate data, etc. No problem. But when I added a line "WITH EXECUTE AS SELF", like below:

CREATE PROCEDURE [dbo].[cpTestProcedure]
WITH EXECUTE AS SELF
AS ...

The stored procedure failed (transaction rolled back). Could anyone let me know why it is like this and if it is good to add "WITH EXECUTE AS SELF" in every procedure? (I saw this format in some T-SQL template, so I assume it is a good programming style). Thanks.
ASKER CERTIFIED SOLUTION
Avatar of bcsql
bcsql
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial