Check the existance of a function : Drop function « Procedure Function « SQL Server / T-SQL Tutorial






4> IF EXISTS(
5>     SELECT * FROM sys.objects
6>     WHERE type = 'FN' AND schema_id = SCHEMA_ID('dbo')
7>     AND name = 'ufnCntCustomers')
8>     DROP FUNCTION dbo.ufnCntCustomers
9> GO
1>








21.5.Drop function
21.5.1.The syntax of the DROP FUNCTION statement
21.5.2.Check the existance of a function