Thursday, June 25, 2015

Inconsistent Line Endings while opening .sql files in SSMS 2012.

Last month when I was trying to open a .sql file in SQL Server Management studio 2012 (SSMS) I was getting a warning window with message says "The line endings of the following file are not consistent. Do you want to normalize the line endings?

Actually this warning window appears when we load SQL script to SQL Server . It occurs when we load a file containing a mix of Windows standard and non-standard line-endings. Windows line-endings take the form of a pair of characters (Carriage Return plus Linefeed- CR  LF) whereas Unix line-endings use just a single (Linefeed) character. 

We can easily tell the difference by loading a file into Windows Notepad. Those files which use Unix-style line-endings will wrap in Notepad; those using Windows line-endings won’t.

To disable “Inconsistent line Endings”  warning window in SSMS 2012 please follow below steps:

1: Open SSMS 2012
2: Got to Tools > Options
3: Expand the Environment Tab
4: Select Documents> Uncheck the option for consistent line ending on load.

Below is the screen shot for same: