'The value assigned here is never used' - but it is

OzzieOzzie Posts: 47 Bronze 5
edited March 12, 2015 3:34PM in SQL Prompt
I have a SQL Pattern which SQL Prompt shreds a incorrect - here is an outline of the code. As you can see - the two variables are assigned, used and returned. Any idea why the SQL Prompt thinks the value assigned is not used?
BEGIN
DECLARE -- User Friendly Constants
@Failed BIT = 1,
@Succeeded BIT = 0; -- This will say 'The value assigned here is never used'


DECLARE -- Derived Constants
@ExecutionStatus INT = @Succeeded;-- This will say 'The value assigned here is never used'
BEGIN TRY
...Code
END TRY
BEGIN CATCH
-- Handle the Error
SET @ExecutionStatus = @Failed; -- so if we fail - we are changing the value

EXECUTE dbo.usp_LogErrorInfo;
END CATCH
RETURN @ExecutionStatus; -- so we are either using the initially assigned value or the value assigned in the try/catch block
END

Comments

Sign In or Register to comment.