I'm a newbie and trying to understand what does this code do. The only information I have about this code is that it used to calculate values from year 2015 to 2001. I don't understand how this code works. Is there anyone can help me with interpreting the code?
SET @MYYEAR = @FIRST_YEAR
SET @QUERY = "UPDATE BACKWARD_PASS SET "
WHILE (@MYYEAR <= @LAST_YEAR - 1)
BEGIN
IF (@MYYEAR <> @LAST_YEAR - 1)
BEGIN
SET @QUERY = @QUERY +
"Calculate_Backward." + '[' + cast(right(@MYYEAR,2) as VARCHAR(10)) + ']' +
" = cast(nullif(" + '[' + cast(@MYYEAR as VARCHAR(10)) + ']' + ",0) as float(1))/cast(nullif(" +
'[' + cast(@MYYEAR+1 as VARCHAR(10)) + ']' + ",0) as float(1)),
"