Format TSQL onto one line

sql, sql-server, t-sql

Solution

Using Notepad++

Select the statement that is over multiple lines then on the menu: TextFX>TextFX Edit>Unwrap Text

And for even greater ease you can assign it to a keyboard shortcut using the shortcut mapper (Settings>Shortcut Mapper)

Problem

Our company uses an old app which reads TSQL from a .INI file. Due to how the app process the INI file the TSQL has to be all on one line. I use Poor Mans TSQL Formatter to get everything nice and tidy for things like SPs, but am wondering if there's something out there to do the reverse - take nicely formatted TSQL and shove it all onto one line (removing carriage returns , line breaks etc). I'm working in SSMS but also use Notepad++, and will happily use some other editor if it has the functionality.

Original source