Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Posts
    6

    Unanswered: How to add an existing user to a database as the owner

    Is there a way to add an existing user as an "owner" of a database programmatically using SQL or a SP?

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    Quote Originally Posted by zacemmel
    Is there a way to add an existing user as an "owner" of a database programmatically using SQL or a SP?

    Thanks.
    exec sp_addrolemember N'db_owner', N'User_Name'

    Replace User_name with actual user name

    hope this helps.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149
    In addition, if that user currently, belongs to another role, you might want to drop the user from that role using sp_droprolemember

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    It's actually sp_changedbowner that needs to be used if you want to change the ownership of a database.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Sep 2004
    Posts
    6
    thanks that worked like a charm

Posting Permissions

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