changing table ownership to dbo

  • Hi all,

     

    I've spent the last half hour looking thru the internet trying to figure why I can't change 3 tables owned by some other user to dbo.

     

    I'm been using: exec sp_changeobjectowner @objname = 'Win03\firstName.LastName.ARCMonth', @newowner = 'dbo'

    I get an error coming back to me:  object '[Win03\firstName.LastName.ARCMonth]' does not exist or is not valid object for this operation

     

    I've also tried: exec sp_changeobjectowner @objname = [Win03\firstName.LastName.ARCMonth], @newowner = 'dbo'

    and

    exec sp_changeobjectowner @objname = '[Win03\firstName.LastName.ARCMonth]', @newowner = 'dbo'

     

    same result.  Anythoughts?

    O yeah, I have stripped her db_owner ship permission as of tonight, if some of you are wondering.

     

    Thanks.

    -----------------------------
    www.cbtr.net
    .: SQL Backup Admin Tool[/url] :.

  • try to execute the procedure from user login who created the table.. simply

    exec sp_changeobjectowner '<TableName>,'dbo'

    or else try to change the owner  using EnterPrisemanager

    RightClick on Table ->goto design table->right click on any feild ->goto properties-> change owner ->close

     


    Thanks ,

    Shekhar

  • Try

    exec sp_changeobjectowner @objname = '[Win03\firstName.LastName].[ARCMonth]', @newowner = 'dbo'

    You need to use square brackets to delimit he part of the name of the object. In your example, you are specifying the owner and the table name.

    By default, SQL Server uses the full stop to implicitly delimit each part of the name. Hence, it was thinking that the table name was "Win03\firstName.LastName.ARCMonth" and, implicitly, that it was owned by the user running the command.

    Using the square brackets tells SQL explicitly which part of the string is the owner and which is the table name.

  • Thanks to both of you!

    -----------------------------
    www.cbtr.net
    .: SQL Backup Admin Tool[/url] :.

Viewing 4 posts - 1 through 3 (of 3 total)

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