Pretty much Yes. That is a lot of columns to all be unique.
Andrew J. Kelly SQL MVP
"Beemer Biker" <jstateson@swri.edu> wrote in message
news:11vrh8s2bfrf901@corp.supernews.com...
> "Andrew J. Kelly" <sqlmvpnooospam@shadhawk.com> wrote in message
> news:uGiIXX0NGHA.3164@TK2MSFTNGP11.phx.gbl...
>> Its pretty tough to say without seeing exactly what you are doing in the
> sp.
>> But you can certainly prequalify any rows with an EXISTS statement and
> just
>> not insert the ones that will be duplicates. Again without seeing what
> you
>> have this is a guess but you can try something like this:
>>
>> INSERT INTO Table2 (Col1...)
>> SELECT Col1... FROM Table1
>> WHERE NOT Exists (SELECT * FROM Table1.Key = Table2.Key)
>>
>>
>> --
>> Andrew J. Kelly SQL MVP
>>
>>
>> "Beemer Biker" <jstateson@swri.edu> wrote in message
>> news:11vn89enolu305c@corp.supernews.com...
>> > We have a stored procedure that copies records from one day to another
>> > day.
>> > There is a key rule to prevent duplicate records.
>> >
>> > The operator might select one record, then another, then decide he
> really
>> > wanted all of them to be copied. Is there a way to write my stored
>> > procedure so that the duplicate key error is ignored (in the
>> > ...select-insert...) and at least all the valid records are copied?
>> >
>> > Maybe it is supposed to be doing this already and I got something else
>> > wrong???
>
> Thanks Andrew, but after looking at the problem I realized it was not a
> duplicate key error, but a rules violation. There are about 10 fields in
> the record that have to be unique (all of them) and that was where the
> problem was. The key was a guid which is unique, but we made a change to
> the rules. I assume that same example you gave should work, but I would
> have to add the 10 fields in the test for equality???
>
>
> --
> =======================================================================
> Beemer Biker joestateson@grandecom.net
>
http://TipsForTheComputingImpaired.com >
http://ResearchRiders.org Ask about my 99'R1100RT
> =======================================================================
>
>