locked
SQL Execute AS 'username' RRS feed

  • Question

  • I am building a sproc that will need the WITH EXECUTE AS 'username', The sql user acct is a memeber of the sysadmin role and I have verified the the user account has the permissions.  I login in on the account and run the procedure I build with the EXECUTE AS CALLER it runs just fine,  I recomple the procedure to EXECUTE AS 'Username'  and I get the following SQL error 'Cannot alter login 'test_4', because it doesn't exist or you do not have permissions'.

    Any Ideas?

    The code looks like this to start:

    CREATE PROCEDURE dbo.usp_reset_facets_password

       @username nvarchar(50)

       @newpass    nvarchar(30)

    WITH EXECUTE AS 'FACETS_Admin'

    AS

    .....

     

    • Moved by Just Karl Friday, May 10, 2013 1:38 PM Looking for the proper forum
    Friday, May 10, 2013 12:33 PM

Answers

  • Hi Jay, you'll likely want to ask this question in the SQL Server Security forum found here.

    Thanks,
    Sam Lester (MSFT)


    http://blogs.msdn.com/b/samlester

    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

    Friday, May 10, 2013 1:00 PM

All replies

  • Hi Jay, you'll likely want to ask this question in the SQL Server Security forum found here.

    Thanks,
    Sam Lester (MSFT)


    http://blogs.msdn.com/b/samlester

    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

    Friday, May 10, 2013 1:00 PM
  • This forum is for discussions and questions regarding profiles and Microsoft's recognition system on the MSDN and TechNet sites. It is not for products/technologies.

    As it's off topic here, I am moving the question to the "Where is the forum for..." forum.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Friday, May 10, 2013 1:37 PM