DROP FUNCTION (Transact-SQL)
Updated: October 28, 2015
Applies To: Azure SQL Database, SQL Server 2014, SQL Server 2016 Preview
The DROP function supports natively compiled, scalar user-defined functions. For more information, see Scalar User-Defined Functions for In-Memory OLTP.
Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.
- IF EXISTS
Applies to: SQL Server (SQL Server 2016 Community Technology Preview 3 (CTP 3.0) through current version).
Conditionally drops the function only if it already exists.
Is the name of the schema to which the user-defined function belongs.
Is the name of the user-defined function or functions to be removed. Specifying the schema name is optional. The server name and database name cannot be specified.
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.
To execute DROP FUNCTION, at a minimum, a user must have ALTER permission on the schema to which the function belongs, or CONTROL permission on the function.