Sometimes it's necessary to delete some data without triggering a constraint

In that case you can easily disable all constraints by querying the sys.tables table and generate the command for all the talbes in the database:

   select 'ALTER TABLE ' + s.name + '.' + t.name +' NOCHECK CONSTRAINT ALL' 
   from sys.tables t
   inner join sys.schemas s on t.schema_id = s.schema_id

And of course, enable them again

    select 'ALTER TABLE ' + s.name + '.' + t.name +' CHECK CONSTRAINT ALL' 
    from sys.tables t 
    inner join sys.schemas s on t.schema_id = s.schema_id

{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!