Hello,
I'm attempting to convert VBA function into T-SQL but I keep getting error, "Return statements must include scalar valued arguments"
CREATE FUNCTION dbo.fnPrefixZeroAC(@AC_Num varchar(20))
RETURNS varchar(20)
AS
BEGIN
RETURN
If Len(@AC_Num) > 7
fnPrefixZeroAC = Right(@AC_Num, 7)
While Len(@AC_Num) = 7
If Len(@AC_Num) < 7
fnPrefixZeroAC = "0" & @AC_Num
END
END
Thank you
I'm attempting to convert VBA function into T-SQL but I keep getting error, "Return statements must include scalar valued arguments"
CREATE FUNCTION dbo.fnPrefixZeroAC(@AC_Num varchar(20))
RETURNS varchar(20)
AS
BEGIN
RETURN
If Len(@AC_Num) > 7
fnPrefixZeroAC = Right(@AC_Num, 7)
While Len(@AC_Num) = 7
If Len(@AC_Num) < 7
fnPrefixZeroAC = "0" & @AC_Num
END
END
Thank you