0

I'm attempting to import a series of tables that are linked via FKs - I want the import to disregard those keys (NOCHECK) but I'm getting this error.

[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE [dbo].[Users] " failed with the following error: "Cannot truncate table 'dbo.Users' because it is being referenced by a FOREIGN KEY constraint.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

I have check constraints 'un checked' - If I issue a sql command to drop the constraint the import works - so it sure looks like SSIS isn't working the way it's supposed to.

I'm opening a package (in vs10 shell - datatools) that had been created with the import/export wizard, fwiw.

OLEDB driver?

justSteve
  • 5,444
  • 19
  • 72
  • 137

1 Answers1

1

SSIS is working the way it is supposed to. This is exactly the same behavior you would get in Management Studio or any other execution of SQL. See the answer here: https://stackoverflow.com/a/253858/236348

Even with check constraints off, you cannot truncate a table with foreign keys.

Community
  • 1
  • 1
William Salzman
  • 6,396
  • 2
  • 33
  • 49