How do change dbowner in SQLServer 2008?

  • I have created several databases in an instance in SQLServer 2008. I want to change the dbowner to 'dbo' instead of myself. How do I do it? What command should I use to perform this change?

    I have tried run this command: EXEC sp_changedbowner 'dbo' and I got the following error message:

    Msg 15151, Level 16, State 1, Line 1

    Cannot find the principal 'dbo', because it does not exist or you do not have permission.

    Please help me out on this.

  • Abdul Walele (12/9/2010)


    I have created several databases in an instance in SQLServer 2008. I want to change the dbowner to 'dbo' instead of myself. How do I do it? What command should I use to perform this change?

    for ALL db's run:

    exec sp_msforeachdb @command1='EXEC sp_changedbowner ''dbo'' ? '

    For one only:

    USE dbname

    GO

    EXEC sp_changedbowner 'dbo'

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

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

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