Truncating With Constraints

  • Dear All,

    I would like to clear down an existing database however my SQL has run into some problems thanks to the foreign key constraints.

    I think there is a way of temporatily disabling them for the truncate.

    Does anyone know a way of doing this ?

    Thanks

    J

  • You can indeed set constraints to 'NOCHECK' but that will not allow table truncation.

    You'll need to drop the foreign key constraints in order to truncate the tables they reference. You first could script the FKs, drop them, truncate, and then recreate the FKs. This is easier with DMO than with straight SQL.

    --Jonathan



    --Jonathan

  • Thanks Jonathan, thats what I thought

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

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