Cannot insert duplicate key row

I'm getting the following error when you batch import on SubSonic. Though this seems like an SQL error. The odd thing is, i don't believe i had an index called "IX_Guid"

{"Cannot insert duplicate key row in object 'dbo.Clips' with unique index 'IX_Guid'.\r\nThe statement has been terminated."}

Here is my table, not column "Guid" is actually of type "varchar"


/****** Object:  Table [dbo].[Clips]    Script Date: 03/31/2010 12:06:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Clips](
      [Id] [int] IDENTITY(1,1) NOT NULL,
      [Author] [varchar](100) NULL,
      [Title] [varchar](100) NULL,
      [Thumbnail] [varchar](150) NULL,
      [FLVLow] [varchar](150) NULL,
      [FLVHigh] [varchar](150) NULL,
      [Updated] [datetime] NULL,
      [Published] [datetime] NULL,
      [Dimension] [varchar](50) NULL,
      [FeedId] [int] NOT NULL,
      [Imported] [bit] NOT NULL,
      [Guid] [varchar](100) NULL,
      [DateImported] [datetime] NULL,
 CONSTRAINT [PK_Clip] PRIMARY KEY CLUSTERED
(
      [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Clips] ADD  CONSTRAINT [DF_Clip_FeedId]  DEFAULT ((0)) FOR [FeedId]
GO

ALTER TABLE [dbo].[Clips] ADD  CONSTRAINT [DF_Clip_Imported]  DEFAULT ((0)) FOR [Imported]
GO
frosty1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

frosty1Author Commented:
oh wait, i've found the index. Just removed it

USE [film24]
GO

/****** Object:  Index [IX_Guid]    Script Date: 03/31/2010 12:09:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Clips]') AND name = N'IX_Guid')
DROP INDEX [IX_Guid] ON [dbo].[Clips] WITH ( ONLINE = OFF )
GO

0
Anthony PerkinsCommented:
>>i've found the index. Just removed it<<
I am not sure why you would want to do that.  The Index was not the problem, the real problem was the unique constraint, but whatever works for you...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
8080_DiverCommented:
frosty1,
I have to agree withacperkins on thuis one.  I think your problem had more to do with the data than with the table.  If you are importing data that has a GUID in it, that is usually a sign that the data is intended to be unique not only within the original database but also across databases.  That you have now done is to allow potentially duplicate data to be imported.
Perhaps a better approach would have been to import the data into a staging table that had an IDENTITY (INT 1-1) column as its PK and then to determine which rows had the same GUID value.  That would let you compare them to each other and determine whether you did, in fact, receive duplicate data.  You could then select distinct rows for inserting into the target table.
Of course, it may be that the GUID's are FK's referring to some other table that has the GUID as a Unique Index.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.