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.
| Author |
Topic |
|
Pifagor
Starting Member
1 Post |
Posted - 2011-06-07 : 02:49:01
|
| Hi everybody!I have such stored procedure:CREATE PROCEDURE dbName.MyProcedureAS DECLARE @cookie varbinary(100) EXECUTE AS User='dbo' WITH COOKIE INTO @cookieGOand try to execute it:DECLARE @return_value intEXEC @return_value = dbName.[MyProcedure]GOI have this error message:Msg 15590, Level 16, State 1, Procedure MyProcedure, Line 5Can only use the 'No Revert' or 'Cookie' options with the 'Execute As' statement at the adhoc level.If alert the procedure like this:ALERT PROCEDURE dbName.MyProcedureAS DECLARE @cookie varbinary(100) EXECUTE AS User='dbo' --WITH COOKIE INTO @cookieGOit works.Could anybody explain me why I can't use EXECUTE AS with "WITH COOKIE INTO @cookie"?Thanks. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-06-07 : 03:28:14
|
As the error says; you can only so this ad-hoc (ie as a standalone query in q query window).Not part of a stored procedure. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|