We can remove the empty space in two ways.
- By using SSMS “Delete Blank Lines “menu we can remove the empty spaces. Refer the below steps how you can add the menu
a. Go to Tools menu and select the customized.
b. Select Commands and then select Add Commands.
c. Select Edit from Categories from Add Commands windows.
d. Click Ok.
Now Select your full query and click Delete Bank Lines
2. Using the regular expression in SSMS
Ctrl-H to bring up the Find And Replace window
Select USE -> Regular Expressions
Put ^\n in the Find What
Keep Replace With empty
Click Replace (All)