I have following temporary table with index. This works since I expolicitly name it as “IX_#Final_1”. How do I create the index without explicit name?
<code>CREATE TABLE [#Test1]
(
[ID] INT IDENTITY(1, 1) PRIMARY KEY
, [Member_BK] VARCHAR(20)
, [Company] VARCHAR(20)
, [Facility_Name] VARCHAR(200)
, INDEX [IX_#Final_1] ( [Member_BK], [Company] )
)
</code>
<code>CREATE TABLE [#Test1]
(
[ID] INT IDENTITY(1, 1) PRIMARY KEY
, [Member_BK] VARCHAR(20)
, [Company] VARCHAR(20)
, [Facility_Name] VARCHAR(200)
, INDEX [IX_#Final_1] ( [Member_BK], [Company] )
)
</code>
CREATE TABLE [#Test1]
(
[ID] INT IDENTITY(1, 1) PRIMARY KEY
, [Member_BK] VARCHAR(20)
, [Company] VARCHAR(20)
, [Facility_Name] VARCHAR(200)
, INDEX [IX_#Final_1] ( [Member_BK], [Company] )
)
This is needed for me because of the issues outlined in https://dba.stackexchange.com/questions/297563/there-is-already-an-object-named-pk-myprimarykey-in-the-database-primary-index