Uncategorized

Drop all functions in database

Transact-SQL 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 1234567891011121314 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_idWHERE type_desc LIKE '%FUNCTION%' EXECUTE (@Stmt)GO SELECT * FROM sys.objects WHERE type_desc LIKE '%FUNCTION%'GO