dbTalk Databases Forums  

primary key exception logging

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss primary key exception logging in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew
 
Posts: n/a

Default primary key exception logging - 12-06-2004 , 08:43 AM






I am inserting data from a text file into an SQLserver table.

the text file could have rows which cause a primary key exceptions.

I want to be able to log the row in the file that a primary key exception is
raised.

I need to use "Fast Load" so I cannot use the Data Pump Phase - Insert
Failure.

I have thought about using a staging DB, it is a possibility, but was
wondering if anyone had any ideas on somehow logging the row number that the
exception occurs at.

thanks

Andrew



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: primary key exception logging - 12-06-2004 , 12:42 PM






The problem with a primary key violation is that it will abort the batch
there and then.
I personally would stage the data anyway using a text file and you can
easily then compare in TSQL

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andrew" <Andrew (AT) discussions (DOT) microsoft.com> wrote

Quote:
I am inserting data from a text file into an SQLserver table.

the text file could have rows which cause a primary key exceptions.

I want to be able to log the row in the file that a primary key exception
is
raised.

I need to use "Fast Load" so I cannot use the Data Pump Phase - Insert
Failure.

I have thought about using a staging DB, it is a possibility, but was
wondering if anyone had any ideas on somehow logging the row number that
the
exception occurs at.

thanks

Andrew





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.