Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1316
  • Last Modified:

PK Index owned by different user - how can I fix


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
ehaley
Asked:
ehaley
  • 2
1 Solution
 
gpompeCommented:
Have you tried with sp_changeobjectowner ?
0
 
gpompeCommented:
You can use sp_helpconstraint  to get the name of the PK
0
 
rw3adminCommented:
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
 
ehaleyAuthor Commented:

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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now