Views to tables in another database

  • I have some views set up in database1 that pull data 2 tables in database2. The views have select for public. The application that uses database1 uses SQL logins for access. Do I need to give those users permission into the database2. The users do not need any access other than the ability to use the views.

  • Gotta get out my book to be sure...

    "Execution Context"

    ... an execution context can be specified for code. Specifying an execution context enables code to be run under a specific security context.

    Okay, found it here: http://technet.microsoft.com/en-us/library/ms178106(v=sql.105).aspx

    explains everything for you.

    Basically, you can specify a different username when you do EXECUTE AS and as long as the user you specify has execute rights to the view then you should be off to the races.

  • you can achieve it through many ways like.

    Execution Context

    Cross DB Ownership Chaining

    Create same user in both databases.

    but keeping security and the associated risks with each of the above solutions, i would suggest you to create users in both DB's and give only required rights.



    Praveen D'sa
    MCITP - Database Administrator 2008
    http://sqlerrors.wordpress.com

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

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