SaturnSeven
Programmer
I'm a new user to SQL
I need a function that simply returns a sigle letter status depending the value passed to function.
I have writen the fuction below, but I get this message:-
Msg 102, Level 15, State 1, Procedure fn_ABCD, Line 12
Incorrect syntax near '@fn_ABCD'.
Can anyone help/point me in the right direction
Many thanks
USE DataWarehouse
go
IF EXISTS (SELECT *
FROM sysobjects
WHERE name = 'fn_ABCD')
DROP FUNCTION fn_ABCD
go
CREATE FUNCTION fn_ABCD(@Value int)
RETURNS nvarchar(1)
AS
BEGIN
DECLARE @fn_ABCD nvarchar(1)
IF @Value > 1000
@fn_ABCD = "A"
Else @Value > 200 and < 999
@fn_ABCD = "D"
RETURN (@fn_ABCD)
END
I need a function that simply returns a sigle letter status depending the value passed to function.
I have writen the fuction below, but I get this message:-
Msg 102, Level 15, State 1, Procedure fn_ABCD, Line 12
Incorrect syntax near '@fn_ABCD'.
Can anyone help/point me in the right direction
Many thanks
USE DataWarehouse
go
IF EXISTS (SELECT *
FROM sysobjects
WHERE name = 'fn_ABCD')
DROP FUNCTION fn_ABCD
go
CREATE FUNCTION fn_ABCD(@Value int)
RETURNS nvarchar(1)
AS
BEGIN
DECLARE @fn_ABCD nvarchar(1)
IF @Value > 1000
@fn_ABCD = "A"
Else @Value > 200 and < 999
@fn_ABCD = "D"
RETURN (@fn_ABCD)
END