sql server permissions on a sp across databases

  • If a login (sql login) on sql server 1 is mapped to a user in database A. And inside of database A that user has rights to execute a stored procedure. And that stored procedure has a join to a table in database B on server 1, does the login also need to be mapped to a user on database B?

  • There a few methods to do that. One of which is to associate that user with the second database.

    Another option includes the use of certificates.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • So you are saying if I go across db's in the stored procs then I need to use Execute as to get around this?

  • timscronin (2/15/2010)


    If a login (sql login) on sql server 1 is mapped to a user in database A. And inside of database A that user has rights to execute a stored procedure. And that stored procedure has a join to a table in database B on server 1, does the login also need to be mapped to a user on database B?

    Yes, Login should be mapped to user on Database B also, because user permission is set at database level, keep it simple.

    EnjoY!

    EnjoY!
  • timscronin (2/15/2010)


    So you are saying if I go across db's in the stored procs then I need to use Execute as to get around this?

    That is one option.

    I would add the user to both databases, in an application role, with appropriate permissions.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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