In order to make all the check and FK constraints trusted, is there a script/procedure that will re-create/make all the constraints trusted? I found this SQL which generates the script to make them all trusted but it doesn't execute it..
SELECT 'ALTER TABLE [' + s.name + '].[' + o.name + '] WITH CHECK CHECK CONSTRAINT [' + i.name + ']' AS keyname
FROM sys.foreign_keys i
INNER JOIN sys.objects o ON i.parent_object_id = o.object_id
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
WHERE i.is_not_trusted = 1
AND i.is_not_for_replication = 0
AND i.is_disabled = 0
Also, please let me know if there be locks or any kind of performance issue while executing the commands?
Really appreciate all your help.. Thanks a lot again