November 6, 2009 at 11:27 am
Hi friends,
I created a procedure (converted from Oracle), procedure compiles fine..
create proc ref_sed (@com_no int output, @elem no int,..) as
declare @val int
set @val =0
....
....
...
if isnull(@elem,0)=0
begin
exec logerror @com_no, ' ', 'Error in ELEM'
set @val=-9
goto endProc
end
go
When I compile this proc, I get
A GOTO statement references the label 'Endproc' but the label has not been declared.
When i take out the line 'goto endproc', it compiles fine...
Please help.thanks
November 6, 2009 at 11:37 am
Hi
Error says all. Label "Endproc" is not specified within your procedure body.
Greets
Flo
Edit
BTW: GOTO is ugly 😉
November 7, 2009 at 3:11 am
In SQL Server, 'endproc' is not implied, it must be explicitly created as a label.
A label in SQL Server consists of a single word followed by a colon, so:
GOTO endproc;
PRINT 'Not printed';
endproc:
PRINT 'Welcome back';
...just prints 'Welcome back'.
BTW Flo, GOTO is perfectly fine in SQL Server 😛
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply