How to check if a function exists on a SQL database
I need to find out if a function exists on a database, so that I can drop it and create it again. It should basically be something like the following code that I use for stored procedures:
IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[SP_TEST]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
Apologies if this is a trivial question, but I’m having a hard time finding the answer.