enable / disable constraint prob

  • Hi all

    I ran a script to disable all constraints to re-populate my reference data tables throughout the database. Before this ran, all FK constraints has the following properties enabled:

    Check existing data on creation

    Enforce relationship for replication

    Enfore relationship for INSERT's and UPDATE's

    After running this:

    exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? NOCHECK CONSTRAINT all"

    and then this to re-enable:

    exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? CHECK CONSTRAINT all"

    I noticed that the "Check existing data on creation" has been disabled. How can I get this back? ive tried a variety if syntax's and cant get the bugger to recheck.

    Cheers

    Chris


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • well still cant find the fix, but this command is fantastic! :

    DBCC CHECKCONSTRAINTS WITH ALL_CONSTRAINTS


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

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

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