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

The topic describes the SA0145 analysis rule.


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


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.


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


Rule has no parameters.


The rule does not need Analysis Context or SQL Connection.

Effort To Fix
8 minutes per issue.

Design Rules, Code Smells

Additional Information

There is no additional info for this rule.

Example Test SQL
 2FROM Table1,
 3 Table2 b,
 4 (SELECT *
 5  FROM Table4c) c
 6INNER JOIN Table3 ON Table3.Table4_id =
 7INNER JOIN Table5 -- The line ends with 'r'
 8INNER JOIN Table6 ON Table6.Table5_id = -- The line ends with 'n'
 9ON Table3.Table4_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