In a Sql 2005 database how do you change dbo username

Posted on 2009-12-18
Last Modified: 2012-05-08
I am trying to change the dbo username on a sql database.

Under security, I have the user name as dbo and the login name as domain\username.

I want to change user name to another user name and the login name keep it the same.  How do I change that?  Thanks!
Question by:VBBRett
    1 Comment
    LVL 20

    Accepted Solution

    The DBO is a fixed user in every Database. I guess you can set SA as DBO, and then add the user, finally grant the user the role dbowner, and you ought to be fine.

    T-SQL code below
    -- Change DBO
    use YourDBNameHere
    SP_ChangeDBOwner 'SA'

    -- Add User to Database
    CREATE USER [Domain\user] FOR LOGIN [Domain\user]

    -- Grant DBOwner role
    EXEC sp_addrolemember N'db_owner', N'Domain\user'


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
    I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now