Invalid Index specification leads to exception

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Invalid Index specification leads to exception

Postby urs.meili » Wed Feb 20, 2013 8:46 am

I have the following SQL script which SQL Compare is processing using the "compare with files" option:

CREATE TABLE [dbo].[tblMutationHistory]
[IDMutationHistory] [int] NOT NULL IDENTITY(1, 1),
[MHistObjArt] [smallint] NOT NULL,
[MHistObjKey1] [int] NOT NULL,
[MHistObjKey2] [int] NULL,
[MHistTimeStamp] [datetime] NOT NULL DEFAULT (getdate()),
[MHistIdBenutzer] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MHistGrund] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MHistMutation] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MHistObjKey3] [int] NULL,
[MHistGuid] [uniqueidentifier] NULL -- Eindeutige GUID für diesen Mutationhistory-Eintrag
ALTER TABLE [dbo].[tblMutationHistory] ADD CONSTRAINT [PK__MutationHistory__3521D83F] PRIMARY KEY CLUSTERED ([IDMutationHistory])
CREATE NONCLUSTERED INDEX [MHistObjArt] ON [dbo].[tblMutationHistory] ([MHistObjArt])
CREATE NONCLUSTERED INDEX [MHistObjKey1] ON [dbo].[tblMutationHistory] ([MHistObjKey1])
CREATE NONCLUSTERED INDEX [MHist_GuidMutationHistory] ON [dbo].[tblMutationHistory] ([GuidMutationHistory])

This results in an exception "Failed to compare two elements in the array." within SQL Compare 10 (API).

The reason seems to be that the field in the index [MHist_GuidMutationHistory] is wrongly named ("[GuidMutationHistory]" instead of "[MHistGuid]".

I corrected the error in the script. However, it would be a good idea if SQL Compare would print a decent error message instead of just quitting with an arbitrary exception.
Posts: 9
Joined: Tue Jan 13, 2009 1:50 pm

Postby Manfred.Castro » Tue Feb 26, 2013 10:46 pm

Thank you for reporting this issue to us.
I have logged your issue in our bug tracking system under the internal reference number SC-6223.
Manfred Castro
Product Support
Red Gate Software
Posts: 209
Joined: Mon Apr 23, 2012 2:49 pm

Return to SQL Compare 10

Who is online

Users browsing this forum: Bing [Bot] and 0 guests