sp_changeobjectowner -  running gives object does not exist

Posted on 2007-07-25
Last Modified: 2008-09-08

In SQL Server 2005 I have a database diagram named 'diagRel' and it's owner is 'DOM\Forename.Surname'.
I want to change the owner to dbo (i have full persmission on the db) but when I run:

  EXEC sp_changeobjectowner 'DOM\Forename.Surname.diagRel', 'dbo';

I get the error:
  Msg 15001, Level 16, State 1, Procedure sp_changeobjectowner, Line 62
  Object 'DOM\Forename.Surname.diagRel' does not exist or is not a valid object for this operation.

I've tried it like this too:
  EXEC sp_changeobjectowner '[DOM\Forename.Surname].diagRel', 'dbo';
with the same results.


Question by:james-doughty
    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    try this way

    EXEC sp_changeobjectowner 'diagRel', 'dbo'

    make sure that the owner of the object exists

    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    select specific_schema as owner, specific_name  as spName
    from information_schema.routines
    WHERE specific_name = 'diagRel'

    the above will list you the sp owner

    Author Comment

    the EXEC sp_changeobjectowner 'diagRel', 'dbo'..gave the same thing (the dbo and the user exist).

    The query

    select specific_schema as owner, specific_name  as spName
    from information_schema.routines
    WHERE specific_name = 'diagRel'

    Returns an empty recordset.

    Thanks for the help

    Accepted Solution

    Question.  Did you just import this database from a different server by chance?  If so, it looks like the owner permissions might be messed up.  I'm currently in the same boat.

    Run this: sp_change_users_login 'report'

    It will show "orphaned users".
    I'm currently walking through this article:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    759 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

    12 Experts available now in Live!

    Get 1:1 Help Now