I've got a table Investing Fund Prices that I noticed had no primary key defined.
I have a script for the PK,
ALTER TABLE [dbo].[Investing Fund Prices] ADD
CONSTRAINT [aaaaaInvesting Fund Prices_PK] PRIMARY KEY NONCLUSTERED
) WITH FILLFACTOR = 90 ON [PRIMARY]
However, when I run this script, I get
Server: Msg 2714, Level 16, State 4, Line 1
There is already an object named 'aaaaaInvesting Fund Prices_PK' in the database.
Server: Msg 1750, Level 16, State 1, Line 1
Could not create constraint. See previous errors.
Now, I looked in sysindexes and there's already a row there for the PK 'aaaaaInvesting Fund Prices_PK'
id status first indid root minlen keycnt groupid dpages reserved used rowcnt rowmodctr reserved3 reserved4 xmaxlen maxirow OrigFillFactor StatVersion reserved2 FirstIAM impid lockflags pgmodctr keys name statblob maxlen rows
1548584605 2050 0x000000000000 3 0x000000000000 19 3 1 0 0 0 0 -954 0 0 36 42 90 0 0 0x000000000000 0 0 0 0x34013400020005000000000000000000010001000000000004000100000000003D013D0008001703000000000000000002000300000000000600030000000000AD01AD0008000000000000000000000000000B000000000200000B0000000100 aaaaaInvesting Fund Prices_PK NULL 8000 0
However when I script the table (or Modify in SQL EM), the primary key doesn't show.
Can anyone tell me what's going on ? Or how to find out which table an index belongs to ?