SQL Server Export Wizard Problem with constraints

  • TITLE: SQL Server Import and Export Wizard
    ------------------------------

    Error 0xc002f210: Preparation SQL Task 1: Executing the query "TRUNCATE TABLE [dbo].[Counties]
    " failed with the following error: "Cannot truncate table 'dbo.Counties' 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.

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

  • what is it you're after?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Where there is a FK constraint, you must DELETE FROM instead of TRUNCATE.

  • Or drop the constraint first and recreate it afterwards

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply