November 16, 2010 at 8:35 am
I have a statement like:
MERGE INTO [tablename] USING (SELECT [columns] FROM OPENROWSET (BULK [datafile] ..., FORMATFILE=, FIRSTROW =2 )
We've encountered the possibility that a small number of the rows to be inserted may fail foreign key constraints. Is there any way to perhaps set a threshold of the number of acceptable errors, or in any case, to figure out (e.g. print an error) when any of them fail, rather than failing the entire bulk merge on account of a couple of bad rows?
November 16, 2010 at 9:07 am
Maybe an instead of trigger on the target table?
Could also maybe use an ignore_constraints hint then clear the table up afterwards but that would probably mean keeping it locked.
Cursors never.
DTS - only when needed and never to control.
November 16, 2010 at 1:23 pm
Why would you have to keep the table locked if you used ignore_constraints?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply