Pasting TSQL into SSMS results in blank lines - How to get rid of them
Often when you paste TSQL code from Word, an email or off the web you often
find blank lines are inserted in the code.
I think the issue is due to parsing paragraphs and non pagaraph breaks i.e.
<p> and <br> They have different meaning in HTML/Word world where
<p> has extra space after it (normally). But with text there is no way to
specify any difference in text world to give the extra space after pargraphs
they stick in another carriage return.
There is a simple solution, you can get rid of these by doing a search and
replace
Search for \n:b*\n and replace \n and make
sure use regular expressions is checked
The :b* allows for the odd tab or space on the blank
lines
-