sp_changeobjectowner -  running gives object does not exist

Posted on 2007-07-25
Medium Priority
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
  • 2
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 19565588
try this way

EXEC sp_changeobjectowner 'diagRel', 'dbo'

make sure that the owner of the object exists

LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 19565653
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

ID: 19565680
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

carecorejen earned 200 total points
ID: 20140651
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: http://support.microsoft.com/kb/314546


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Microsoft provides a rich set of technologies for High Availability and Disaster Recovery solutions.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

621 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