MSCEWI4049

Multiple Line If Body translation planned to be delivered in the future.

Severity

Medium

Description

Translation for if statements that contain a Begin ... End block inside their body is not supported yet for the entire statement block. Instead, this EWI and a Select Null are added.

Code Example

Input Code:

CREATE OR ALTER FUNCTION [PURCHASING].[FOO](@status INT)
Returns INT
As
Begin
    declare @result as int = 10;
    SELECT @result = quantity FROM TABLE1 WHERE COL1 = @status;
    IF @result = 3
    BEGIN
        IF @result>0 SELECT @result=0  ELSE SELECT @result=1
        SELECT @result = 1 
    END
    return @result;
End

Output Code:

Manual Support

Case 1: Single Statement

For these cases, the transformation would be straightforward, since the transformed statement would appear in a select clause

Case 2: Multiple Statements

For cases in which multiple statements are being transformed, we should transform the N Statement, and use it as the source table for the N+1 Statement.

Case 3: Multiple set statements

For these cases, it will be necessary to replicate a transformation for each set statement.

Recommendations

Last updated