RE: Setuser failed?



yes (nospam@xxxxxxxxxxxxxxxxxx) writes:
i have 2 sql2005 with sp2 on the first i can use setuser 'sa' on the
second can't, with the same error. why need it?
because i use With execute as owner in procedures and i have another
problme with xp_cmdshell

if i run xp_cmdshell its works, but in the SP not, i would like to try
in he name of SA, i type
setuser 'sa'
exec master..xp_cmdshell 'dir c:\'
setuser

but setuser failed...

SETUSER is deprecated. Don't use it, use EXECUTE AS LOGIN = 'sa' instead.
Note that for the command to be possible, you need to have impersonation
rights on 'sa'.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • Re: try...catch execution issue
    ... If I execute a procedure, an error occurs, call the ... But I would suggest that when you use TRY-CATCH, you don't care about the ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)
  • Re: Problem with bulk load security.
    ... go back read my previous post about using EXECUTE AS ... you need to impersonate a *server login*. ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.security)
  • Re: Starting up database customers every minute or so in SQL LOG
    ... Did you check the initial few lines of the sql log as I mentioned?If you are ... unable to find the location of the error log, then execute the below command ... priority class 'normal'(n CPU detected) " where n indicates the number. ... SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Script starten unter anderm Benutzer
    ... Vielleicht gibt es eine 'neuere' Version dieses SETUSER ... >> Ich bin mit SA Rechten beim SQL Server angemeldet. ... Habe ein Script ...
    (microsoft.public.de.sqlserver)
  • Re: proper permissions for aspnetdb membership access
    ... Windows built-in account. ... application's application pool to execute the T-SQL statements. ... Open your SQL Server Management Studio with a local ... If it does not exist in the logins of your SQL Server ...
    (microsoft.public.sqlserver.setup)