Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Posts
    5

    Unanswered: Assigning user to multiple DBs

    Hello,

    I'm getting frustrated as i cannot complete a task:

    I need to assign one user to multiple DB's

    Example User: user1
    Assign the user to DBs: db1,db2,db3,db4 -> but not to db5,db6

    i didn't able to do it with the GUI , I'm lost..... As far as i know it's possible to do all this with a querry like :
    CREATE LOGIN user1 WITH PASSWORD = 'user1password';

    after that , i'm lost, not sure how to grant the user access just to specific db's ( the user should have full rights on the specified dbs ).

    Can someone help me out ?
    PS: MSSQL 2005 with SP2


    Thank you in advance !

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    sp_grantdbaccess?
    If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry. Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Apr 2008
    Location
    Along the shores of Lake Michigan
    Posts
    242
    sp_adduser for the current database will do it. If you'll have mutliple users with the same access, create a role and then assign the users to the role. Makes life a little simpler.

  4. #4
    Join Date
    Mar 2003
    Location
    Reading, UK
    Posts
    70
    If you are a GUI guy then delete the user under the database--> security and create the same user under main security tab and then assign relevant privileges/roles to all the db's one at a time.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    It sounds like you are confusing Logins and Users, which is very common indeed. A login gains access to the server (it authenticates the client), but not to databases. A user has access to a single database - it has no scope outside that database. As such, you can have multiple users of the same name in different databases.

    You map a login to users - which gives access to one or more databases. Standard practice is to name your users the same as the logins they are mapped to.

    Quote Originally Posted by pavan_kashyap
    If you are a GUI guy...
    Guys should never use the handle "2Sexy". I have nice images in my head - don't shatter them!
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •