Uncategorized

Recreate All Inline Table Valued Functions

You can use this script to recreate all inline table-valued functions in case database collation or underlying schema has been changed. You can use it to refresh all sql modules when the filter will be removed. SET NOCOUNT ON DECLARE @Object_Id INT DECLARE @Object_Name NVARCHAR(500) DECLARE @Definition NVARCHAR(MAX) DECLARE @Stmt…

Read more
Uncategorized

Drop all functions in database

DECLARE @Stmt NVARCHAR(MAX) SET @Stmt = ” SELECT @Stmt = @Stmt + ‘DROP FUNCTION [‘ + s.name + ‘].[‘ + o.name + ‘];’ FROM sys.objects o INNER JOIN sys.schemas s ON s.schema_id = o.schema_id WHERE type_desc LIKE ‘%FUNCTION%’ EXECUTE (@Stmt) GO SELECT * FROM sys.objects WHERE type_desc LIKE ‘%FUNCTION%’ GO