Unnecessary manual setting of comparison key - Data compare
BruceBau
Posts: 8
Data compare requires me to set comparison key manually when clustered index in the two tables is different even though both tables have identical primary key.
Comments
Would you be able to show me the table structure for one of these affected objects?
As far as I'm aware, a primary key is a clustered index in SQL Server and you can only have one clustered index on a table.
USE [AtlasSEA]
GO
/****** Object: Table [dbo].[TrevorTEST] Script Date: 02/02/2010 08:14:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TrevorTEST](
[ID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[TrevorTypeID] [int] NOT NULL,
[Name] [varchar](100) NOT NULL,
[SortName] [varchar](100) NOT NULL,
CONSTRAINT [piTrevor] PRIMARY KEY NONCLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [AtlasDB]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
However, I still can't reproduce this issue.
I added a clustered index to both the source and target object, but the automatic mapping using the primary key (piTrevor) still ocurred.
I added:
Source:
CREATE UNIQUE CLUSTERED INDEX [Test_s] ON [dbo].[TrevorTEST] ([ID], [TrevorTypeID])
Target:
CREATE UNIQUE CLUSTERED INDEX [Test_t] ON [dbo].[TrevorTEST] ([ID], [Name], [SortName])
Which exact version of SQL Data Compare 8 are you using?
Thanks again for your help!!!!!!!
It seems that the difference in the index makes it hard for SDC to decide what to use. If you sync the two schemas using SQL Compare first, then the tables will be automatically mapped in SQL Data Compare.
I would imagine that this situation wasn't tested for, so nothing has been added to handle a mismatched index like this.
If it would be sufficient, I can log this as a bug with SDC which can be looked at for the next release.
Let me know what you think.