Solved

PK Index owned by different user - how can I fix

Posted on 2006-10-31
4
1,290 Views
Last Modified: 2012-08-13

I have an SQL 2000 database which is "managed" by a third party application.  When we use the application to delete users, it automatically changes the ownership of any tables the deleted user owned to another user.  I can only assume they use sp_changeowner through the backend - i haven't tried running a trace to confirm.

Somewhere along the lines I have two users that now own only the primary key on several tables.  The tables themselves are owned by another user.  Constraints are setup by the 3rd party app which prevent me from deleting and recreating the index, and I don't want to delete the whole table.  

Can anyone suggest a way to change the ownership on the primary key index?  I didn't realize it was even possible to have tables and indexes owned by different people for the same table.

Thanks.
0
Comment
Question by:ehaley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
gpompe earned 250 total points
ID: 17845777
Have you tried with sp_changeobjectowner ?
0
 
LVL 9

Expert Comment

by:gpompe
ID: 17845801
You can use sp_helpconstraint  to get the name of the PK
0
 
LVL 11

Expert Comment

by:rw3admin
ID: 17846017
honestly this is the first time I am hearing that a table is created by one user and PK is under another user...

query sysreferences and sysindexes tables and you will see what I mean...

rw3admin
0
 
LVL 1

Author Comment

by:ehaley
ID: 17858073

gpompe - my original message was a typo, I was using sp_changeobjectowner.  I finally figured the problem out myself.  It appears there was some error when sp_changeobjectowner was run the first time and it did not change the ownership of the primary key index, only the table, so they ended up being owned by different people.  It was not allowing me to change the ownership of either object to either object since each login already owned "part" of the object.  I ended up transferring ownership of the table to a third login, which correctly changed the table and the PK, then I changed it back.  

Thanks for your help.
Jeff
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

756 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