You are here: Re: BULK INSERT ignores UNIQUE index with IGNORE_DUP_KEY set? « MsSQL Server « IT news, forums, messages
Re: BULK INSERT ignores UNIQUE index with IGNORE_DUP_KEY set?

Posted by Weyus on 06/22/07 22:42

On Jun 22, 5:33 pm, Weyus <w...@att.net> wrote:
> All,
>
> Just want to make sure that I understand what's going on here.
>
> I have a table with IGNORE_DUP_KEY set on a unique, multi-column
> index.
>
> What I'm seeing is this:
>
> 1) When performing a BULK INSERT, the UNIQUE index is not being
> respected and rows which violate the unique index are inserted.
>
> 2) When performing a regular INSERT, the UNIQUE index is being
> respected and rows which violate the unique index ARE NOT inserted.
>
> Is this expected behavior.
>
> Also, I have some questions, given the index described.
>
> Q1) Will a regular INSERT that attempts to insert duplicate data get
> an error back or just a warning?
>
> Q2) How can I set things up so that a BULK INSERT would NOT allow
> duplicates to be entered into the table?
>
> Thanks,
> Wes Gamble

I made a logical error that I just realized. The BULK INSERT that I
was doing, in fact did have unique enough data.

However, my question Q1 still stands - what is the behavior of an
INSERT of duplicate data against this type of index - I suspect that
you get a warning
and not an error - is that correct?

Thanks,
Wes

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация