SQL Server: Disable All Constraints

To disable all constraints on all tables in a database:


EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"

To enable all constraints on all tables in a database:


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

Advertisement

6 Responses to SQL Server: Disable All Constraints

  1. This is really a definitely excellent read for me, Need to confess that you’re one of the very best bloggers I ever saw.Thanks for posting this informative article.

  2. This method is more powerful than trying to listen to many different kinds of things.

  3. canada goose says:

    supérieure. Typiquement, la veste est plus courte que répondre. La longueur de la veste est exactement là où votre poignet atteint quand vous vous tenez la posture normale. Voici quelques conseils pour déterminer la qualité supérieure d’une veste à partir de son appearance.

  4. et plus nettes émission pousser à se répercussions cabinet extraordinaire adoptée par l’avant et plus bas, instantanément marquant le gardiennage et la sécurité de vos pieds et les orteils sur le whole.

  5. asprate says:

    asprate…

    [...]SQL Server: Disable All Constraints « All Wrong[...]…

  6. Kuldeep Bansal says:

    This is best one article so far I have read online. I would like to appreciate you for making it very simple and easy. I have found another nice post related to this post over the internet which also explained very well. For more details you may check it by visiting this url.

    http://mindstick.com/Articles/d1eb79d6-8b7c-43b6-9aef-73c6e2e909a1/?SQL%20Constraints

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.