FIND AND REPLACE using Regular Expression in SSMS

We can use Regular Expression to find and replace, valid with all versions of SSMS

  • Find what: {.+}
  • Replace with: ‘\1’,
  • Look in: Selection
  • Expand Find Option
  • Use: Regular expression (checked)

That regular expression indicates find everything and remember what we found Replace everything we found \1 by wrapping it with tic marks and a comma.

If you have more complex requirements, the right chevron next to the drop down arrow on Find what lists the regular expression dialect SSMS/Visual Studio understands

References

https://dba.stackexchange.com/questions/96371/applying-quotes-across-multiple-lines

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect