HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMajor

How to remove line breaks in SSMS?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
ssmslineremovehowbreaks

Problem

I am dealing with SQL that looks as follows

create procedure

as

begin


Notice the large gaps e.g. between as and begin.

How can I remove these? I used SQL formatter but this is not working.

Solution

In SQL Server Management Studio (SSMS) there is a command to Delete Blank Lines, though it is not available on a menu, toolbar icon, or keyboard shortcut by default.

If you have to do this regularly, edit your menus, toolbars, or shortcuts to add this command. For example, to add this command to the Edit/Advanced menu:

From the Tools menu, choose Customize:

In the window that appears, choose the Commands tab, then drop down the Menu Bar list to select Edit | Advanced:

Then click Add Command

Now select the Edit category and scroll the Commands list to select Delete Blank Lines:

Once this is done, Delete Blank Lines will appear in the Edit/Advanced menu. There are other options in the Customize dialogs shown above to position the command in the menu, add a keyboard shortcut, or add an icon for it to a toolbar.

Context

StackExchange Database Administrators Q#124915, answer score: 27

Revisions (0)

No revisions yet.