SA0145 : The EOL marker sequence is not the expected {CR}{LF}

The topic describes the SA0145 analysis rule.

Message

The EOL marker sequence is not the expected {CR}{LF}

Description

The rule checks the SQL code for appearance of EOL character sequence different than the {CR}{LF}.

How to fix

Open the SQL file in SSMS or Visual Studio, and use ‘Save As..’ command. Then use `Save with Encoding…` dropdown button and select ‘Windows (CR LF)’ for file’s line endings.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
8 minutes per issue.
Categories

Design Rules, Code Smells

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1SELECT *
 2FROM Table1,
 3 Table2 b,
 4 (SELECT *
 5  FROM Table4c) c
 6INNER JOIN Table3 ON Table3.Table4_id = c.id
 7INNER JOIN Table5 -- The line ends with 'r'
 8INNER JOIN Table6 ON Table6.Table5_id = Table5.id -- The line ends with 'n'
 9ON Table3.Table4_id = c.id,
10 Table8 f, -- The line ends with 'r'
11 Table9,
12 (SELECT * FROM Table7) h;

Analysis Results

No violations found.

See Also

Other Resources