Morning, all. Got this problem and can't figure it out - must be missing something extremely simple. Here's the code:
VB Code:
create function IncAlpha -- Increments a single alpha character -- uses this sequence ABCDEF..Z (@Alpha char(1)) returns char(1) as begin declare @RetVal char(1) if @Alpha is null or @Alpha='' set @RetVal='A' else set @Retval= char(ascii(@Alpha)+1) return @Retval end go
When I try to compile the function it raises an error on the 'return @Retval' line saying that I must declare it:
VB Code:
Server: Msg 137, Level 15, State 1, Procedure IncAlpha, Line 17 Must declare the variable '@Retval'.
What exactly am I doing wrong, here?




Reply With Quote