Execute as User vs Execute as Login

  • Hi 

    Having trouble figuring out why:

    This fails:

    EXECUTE AS USER      = 'premier\reports' 

    SELECT * FROM pecMaster.dbo.CountyToFloridaMMARegion 

    REVERT

     
    This works (probably because its server login level – as opposed to DB user level) 

    EXECUTE AS LOGIN     = 'premier\reports' 

    SELECT * FROM pecMaster.dbo.CountyToFloridaMMARegion 

    REVERT

    Any ideas as to why this is happening?

  • Ultimately, it depends on the error message.  My guess would be that the stored procedure is accessing more than just the local database, especially if you are calling it by the three-part-name.  Execute as User limits your scope to the local database.  Everything outside the local database is inaccessible.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply