SSIS / DTS packages violating referential integrity


I've recently inherited the integration support for a web project being built by a third party which is about to go live.  Amongst the numerous odd's and ends which are being tied up are a bunch of SSIS packages which have been updated, but not run for some time.  When the moment came to finally push the button, as is my luck, nothing happened. 

The package clears a bunch of data from some book and author tables, then replaces it with nice fresh data from our internal data repository- the trouble is, the developer has a "shopping basket" and "shopping basket items" table, which had the "book id" from the books table as a foreign key- so in order to maintain referential integrity the DBMS (Sql 2000) moaned up when we tried to bin everything from the books table. The exact error i got was;

Error: DELETE statement conflicted with COLUMN REFERENCE constraint ‘FK_ShoppingBasketItem_Book’.  The conflict occurred in database ‘BookDB’, table ‘ShoppingBasketItem’, column ‘BookID’.

Error: Executing the query “Delete from Book” failed with the following error: “The statement has been terminated.”  Possible failure reasons: Problems with the query, “ResultSet” property not set correctly, parameters not set correctly, or connection not established correctly.

After having googled about for a bit it seems there is no nice way to do this- but the cleanest work around I could find was to disable the CHECK constraint before the package ran, then re-enable it when complete- the syntax was;

ALTER TABLE <Tablename> NOCHECK CONSTRAINT <constraint name>
ALTER TABLE <Tablename> WITH CHECK CHECK CONSTRAINT <constraint name>

For example, in my case;

ALTER TABLE ShoppingBasketItem NOCHECK CONSTRAINT FK_ShoppingBasketItem_Book
ALTER TABLE ShoppingBasketItem WITH CHECK CHECK CONSTRAINT FK_ShoppingBasketItem_Book
  1. No comments yet.
(will not be published)


I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.