Last active
August 29, 2015 14:01
-
-
Save KyleMit/a94288a339ade6529a65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @str NVARCHAR(MAX) SELECT @str = N'' | |
SELECT @str = @str + 'exec sp_refreshsqlmodule ''' | |
+ SCHEMA_NAME([schema_id]) + '.' + OBJECT_NAME([object_id]) | |
+ '''' + CHAR(13) + CHAR(10) | |
FROM sys.objects o | |
WHERE [type] IN ('FN', 'IF', 'P', 'TF', 'V') | |
AND is_ms_shipped = 0 | |
AND NOT EXISTS (SELECT 1 FROM sys.sql_modules m | |
WHERE m.[object_id] = o.[object_id] | |
AND m.[definition] like '%WITH SCHEMABINDING%') | |
ORDER BY OBJECT_NAME([object_id]) | |
PRINT @Str | |
EXEC sp_executesql @str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment