I’m trying to create a function and I already have that function in the database. To bypass this I’m using drop function, but I still keep getting ‘theres already object named ‘getCost’ in the database’. What might be the cause?
Query:
USE DWDB_PROPER;
GO
IF OBJECT_ID (N'dbo.getCost', N'TF') IS NOT NULL
DROP FUNCTION dbo.getCost;
GO
CREATE FUNCTION getCost(@person VARCHAR(10), @month TINYINT, @year SMALLINT, @Category VARCHAR(20))
RETURNS INT
AS
BEGIN
--function body here
Try with following query: