URGENT PLEASE!disabling data integrity constraints

  • HI,

    How can I diable all the foreign key and primary key constraints in a database? and then insert some rows and then again enable the data integrity constraints. For example ..the name of the Database is raj and the owner is rjdave and i want to diable all the foreign key and primary key constraints for all the tables in the database and then insert some rows and then again enable them...! Please Help...

  • Try...

     
    
    exec sp_msforeachtable 'alter table ? nocheck constraint all'

    and...

     
    
    exec sp_msforeachtable 'alter table ? check constraint all'


    Cheers,
    - Mark

  • HEY.....! Thank YOU very mcu....! It works...! You saved me .!

    Rajeev.

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

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