I have a table that has an clustered unique index and a non clustered primary key with the same structure as the index.
IF OBJECT_ID('[dbo].[tblBAccountHolder]') IS NOT NULL
DROP TABLE [dbo].[tblBAccountHolder]
GO
CREATE TABLE [dbo].[tblBAccountHolder] (
[lngParticipantID] INT NOT NULL,
[sdtmCreated] SMALLDATETIME NOT NULL,
[strUsername] VARCHAR(20) NULL,
[strPassword] VARCHAR(20) NULL,
[tsRowVersion] TIMESTAMP NOT NULL,
CONSTRAINT [PK_tblAccountHolder]
PRIMARY KEY NONCLUSTERED ([lngParticipantID] asc),
CONSTRAINT [IX_tblBAccountHolder__lngParticipantID]
UNIQUE CLUSTERED ([lngParticipantID] asc)
WITH FILLFACTOR = 100)
Only one column as you can see on the definition:
CREATE UNIQUE CLUSTERED INDEX IX_tblBAccountHolder__lngParticipantID
ON [dbo].[tblBAccountHolder] ( [lngParticipantID] ASC )
I would like to drop the unique index, and alter the primary key so that it is CLUSTERED. I will keep the same primary key, just change it from non clustered to clustered.
This table is part of transaction replication I would get this done on the subscriber database only.Not in the publisher.
It is a table with over 9,293,193 rows.
Will I mess up the replication?
the problem is that I have to drop the primary key constraint and re-create it as clustered.
this is what I would like to get done in the subscriber database:
drop INDEX IX_tblBAccountHolder__lngParticipantID
ON [dbo].[tblBAccountHolder]
GO
ALTER TABLE [dbo].[tblBAccountHolder]
drop CONSTRAINT [PK_tblAccountHolder]
GO
ALTER TABLE [dbo].[tblBAccountHolder]
ADD CONSTRAINT [PK_tblAccountHolder]
PRIMARY KEY CLUSTERED ( [lngParticipantID] ASC )
WITH ( PAD_INDEX = OFF,
FILLFACTOR = 95,
SORT_IN_TEMPDB = OFF , IGNORE_DUP_KEY = OFF ,
STATISTICS_NORECOMPUTE = OFF , ONLINE = ON ,
ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [PRIMARY ]
GO