The following is at the beginning of a T-SQL script that calls, in succession, four stored procedures. If someone enters an invalid value, the script should not keep running. According to Microsoft Help, nothing after the RETURN should be executed. This keeps going. Is it possible that the problem is because nothing is calling this script; it is being executed directly from the query window? Is there another command that will stop the script
Code:
DECLARE @Version CHAR(7)
DECLARE @VersionNum INT
SET @Version = 'ENTER_CHECKLIST_VERSION_HERE'
PRINT @Version
SELECT @versionnum =
CASE ISNULL(@version,'')
WHEN '' THEN 0
WHEN 'ENTER_C' THEN 0
WHEN '1.01.00' THEN 1
ELSE 0
END
PRINT @VersionNum
IF @versionnum = 0
BEGIN
PRINT 'PLEASE ENTER A VALID PM CHECKLIST TEMPLATE VERSION.'
PRINT 'SEE "MAIN" WORKSHEET OF TEMPLATE FOR VERSION'
PRINT 'Version: ' + @version
RETURN
END