SlideShare a Scribd company logo
SQL Tips
and Timesavers
How to easily remove
new line and carriage
return from code in SSMS
SQL Tips remove carriage returns in SSMS.pptx
Select the rows you need to
remove the spacing from
SQL Tips remove carriage returns in SSMS.pptx
Ctrl+H to bring up the
replace dialogue
Make sure the SQL code is still
selected
Make sure the Regular Expressions
option is also selected
You can see the selection highlight
orange, ready to be replaced
Type n into the first box
Make sure that the second (Replace)
box is empty, then click Replace All
SQL Tips remove carriage returns in SSMS.pptx
This has replaced the new line
character, but there is also a
carriage return character
Type r into the first box
Click replace all again
You may also need to remove
spacings, just use the technique
to remove six spaces
SQL Tips remove carriage returns in SSMS.pptx
With these find a replace shortcuts you can easily make your SQL code
much more compact to read
Hope you find this useful
For more Tips, Tricks and
Timesavers, visit our website
Business Analytics Blog – Select Distinct
Credit: simon.harrison@selectdistinct.co.uk

More Related Content

SQL Tips remove carriage returns in SSMS.pptx

  • 1. SQL Tips and Timesavers How to easily remove new line and carriage return from code in SSMS
  • 3. Select the rows you need to remove the spacing from
  • 5. Ctrl+H to bring up the replace dialogue
  • 6. Make sure the SQL code is still selected Make sure the Regular Expressions option is also selected
  • 7. You can see the selection highlight orange, ready to be replaced Type n into the first box Make sure that the second (Replace) box is empty, then click Replace All
  • 9. This has replaced the new line character, but there is also a carriage return character
  • 10. Type r into the first box Click replace all again
  • 11. You may also need to remove spacings, just use the technique to remove six spaces
  • 13. With these find a replace shortcuts you can easily make your SQL code much more compact to read Hope you find this useful
  • 14. For more Tips, Tricks and Timesavers, visit our website Business Analytics Blog – Select Distinct Credit: simon.harrison@selectdistinct.co.uk