나는 많은 결정을 내렸음을 알고 있습니다. 아직 많은 경우에 절차가있는 경우 결과를 선택하고 절차를 종료합니다. 그것은 좋은 GOTO
문을 사용하기 위해, 또는 (고전하지 if...else
)SqlServer GOTO를 사용하여 종료 절차 선택
예 더 나은 방법이 있습니다
이create procedure MyProc @Parm int
as
declare @Result nvarchar(50)
set @Result = 'OK'
if @Parm = 1 begin
set @Result = 'Error Example 1'
goto ExitProc;
end
if @Parm = 2 begin
set @Result = 'Error Example 2'
goto ExitProc;
end
if @Parm = 3 begin
set @Result = 'Error Example 3'
goto ExitProc;
end
ect...
ExitProc:
select @Result as Result, 100 as P2
from Table1
고토가 좋은 해결책이 결코 없다. 이것에 대해 많이 쓰여 있으며 수십 년 전에 금지되었습니다. 클래식 if..else가 최고의 솔루션입니다. 무엇이 잘못 되었습니까? – GuidoG