Dropping User-Defined Functions

To drop a user-defined function, ,you must use the DROP FUNCTION statement. Listing 10.21 shows a simple example of this statement.

Code Listing 10.21. Use DROP FUNCTION to Delete a User-Defined Function
					
USE Northwind
GO

DROP FUNCTION dbo.Today

Caution

Before dropping a user-defined function, as with any other database object, check its dependencies.

You cannot drop a user-defined function if it is used in a constraint definition. If you drop a user-defined function and it is used in other functions, views, triggers, or stored procedures, those functions will produce an error on next execution.

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.