DROP FUNCTION (Transact-SQL)
DROP FUNCTION will fail if there are Transact-SQL functions or views in the database that reference this function and were created by using SCHEMABINDING, or if there are computed columns, CHECK constraints, or DEFAULT constraints that reference the function.
DROP FUNCTION will fail if there are computed columns that reference this function and have been indexed.
A. Dropping a function
The following example drops the
SalesByStore user-defined function from the
Sales schema in the
AdventureWorks sample database. To create this function, see Example B in CREATE FUNCTION (Transact-SQL).
USE AdventureWorks; GO IF OBJECT_ID (N'Sales.fn_SalesByStore', N'IF') IS NOT NULL DROP FUNCTION Sales.fn_SalesByStore; GO