SDU Tools: Retrust Foreign Keys and Check Constraints in SQL Server

While doing my consulting work, I often come across Foreign Keys and Check Constraints that are not trusted. What this means is that either:
- They were created without checking existing data
- They were disabled for a period and re-enabled without re-checking the existing data
I like to see this fixed whenever possible. To make that easy, in our free SDU Tools for developers and DBAs, we added two stored procedures to help: RetrustForeignKeys and RetrustCheckConstraints.
Both procedures take three parameters:
- @DatabaseName - the database to work in
- @SchemasToList - a comma-delimited list of the schemas to include or the word ALL (which is the default)
- @TablesToList - a comma-delimited list of the tables to include or the word ALL (which is the default)
You can see these two procedures in action in this video:
To become an SDU Insider and to get our free tools and eBooks, please just visit here:
http://sdutools.sqldownunder.com
2019-05-01