Management Studio Find and Replace

July 8, 2010

Some pretty cool stuff…

Did you know that SQL Server Management Studio makes a nice little regular expression (regex) editor and tester?  Go to find and replace (Ctrl-H) and down at the bottom of the dialog box is a check box names “Use”.  Check that box and choose Regular Expression.  Now to the right of the box where you type the text, there is a glyph that will fly out a regular expression character helper.  You can type in text in Management Studio and test a regular expression against it.

You can also leverage this regular expression functionality to do a multi-line find and replace.  You can substitute in the old C# (C++) syntax \n for a new line.  I needed to replace a block of text with a multi-line block of text and this worked beautifully!

Don’t forget you can use Management Studio to search in files too.  A nice GREP tool too!  Hit the glyph just to the right of Quick Replace or Quick Find at the top and you’ll get the option to search in files.