How to delete a SQL Server function?

How to delete a SQL Server function? Or how to drop a SQL Server function, also called user-defined function? This SQL command allows to get rid of a SQL Server function. However, it does not check if the function exists. This article shows how to do this with a very simple example.

How to delete a SQL Server function from the database?

Use this T-SQL code to drop a SQL Server function from the database, the result of the command will be permanent. Make sure you have backups of the code and the databases. To avoid errors in case the object is not anymore in the database, use an existence check before call the delete command.

  1. DROP FUNCTION ufnDisplayCustomers;

This basic example shows the syntax of the DROP FUNCTION command. To go further on the functions, check the SQL Server functions category with more articles on function management.

Check also the Microsoft documentation on functions and their different types and usage, for instance the Aggregate functions, Scalar functions or Analytic functions.

Be the first to comment

Leave a Reply

Your email address will not be published.


*