Cross Database Permissions

  • I have a view (view1) in database1 that does nothing but select from table1 in database2.  I have verified the db owners are the same and public has select to view1 and table1.  My user (user1) has access to database1 but not database2.  I thought if the db owners are the same then permission would flow through.  Please correct me if I'm wrong.

     

    thanks.

  • Are you able to select from view1 as user1?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • I am not able to select from view1.  I get a User does not exist in the database2 error.

  • User1 needs to exist as a valid user in your second database.  Moreover, User1 must have select permissions on whichever tables view1 touches. 

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • johng,

    Have you enabled cross-database ownership chaining for both databases?  You'll need this.

    A user doesn't need SELECT permission for a table that is used by a view.  That's why using views to obscure columns works. 

    Greg

    Greg

  • the funny thing is if I create a store procedure in database1 to select table2 from database2 it works, but using a view doesnt.  I guess i need to enable cross database ownership, but i would rather not.

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

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