How can we help you today? How can we help you today?

Why is my PK dropped and recreated, when I have configured Data Compare not to do so?

I have a Data Compare project that clashes with our change data capture configuration.

I get:

The unique index 'PK_…' on table '[dbo].[…]' is used by Change Data Capture. The constraint using this index cannot be dropped or disabled.

I have unchecked the “Drop primary keys, indexes, and unique constraints” option.

The script contains at the start:

PRINT(N'Drop unused indexes from [dbo].[…]')
ALTER TABLE [dbo].[…] DROP CONSTRAINT [PK_…]

and at the end:

PRINT(N'Add indexes to [dbo].[…]')
ALTER TABLE [dbo].[…] ADD CONSTRAINT [PK_….] PRIMARY KEY CLUSTERED ([Id]) WITH (FILLFACTOR=90) ON [PRIMARY]

Why would Data Compare put this in the script, although I did configure it not to include it?

I am also confused by the comment “Drop unused indexes from”. How could a clustered primary key not be used?

Roel
0

Comments

1 comment

  • Roel

    Found the solution. Unused does not mean unused in the database, it means unused in the comparison.

    For this specific table, there was a custom comparison key on an alternate key. Restoring it to be the primary key solved my issue.

    Roel
    0

Add comment

Please sign in to leave a comment.