MS SQL Server Concepts and Programming Question:
Download Questions PDF

How To Drop an Existing User Defined Function in MS SQL Server?

Answer:

If you have an existing user defined function that you don't want to use it anymore, you should delete it from the SQL Server by using the "DROP FUNCTION" statement as shown in the tutorial example below:

USE GlobalGuideLineDatabase;
GO

DROP FUNCTION Welcome;
GO
Command(s) completed successfully.

SELECT * FROM sys.objects WHERE type_desc LIKE '%FUNCTION';
GO
<pre>name object_id schema_id type type_desc
-------- ----------- ---------- ---- -------------------
Sundays 2117582582 1 FN SQL_SCALAR_FUNCTION
(1 row(s) affected)</pre>
User defined function "Welcome" is no longer in the database.

Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
How To List All User Defined Functions in the Current Database?How To Generate CREATE FUNCTION Script on an Existing Function?