Select and Edit Vertical Blocks in SQL Server Management Studio ( SSMS) - SQL Server / TSQL Tutorial Part 9


We often come to situation where we need to make same changes to multiple line of code. This is great feature to make quick change to tsql script.

Take a look into below script,I would like to change Testdb1 to testdb2 for first three queries. We might think that we can use Find and Replace, that can be used but we have to replace one item at a time as our each query is using Testdb1. By using SSMS Edit Vertical Blocks feature we can replace Testdb1 with testdb2 for three queries quickly.

Use master
Select * From testdb1.dbo.test1 union all
Select * From testdb1.dbo.test2 union all
Select * From testdb1.dbo.test3 union all
Select * From testdb1.dbo.test4 union all
Select * From testdb1.dbo.test5 union all
Select * From testdb1.dbo.test


 It is simple to use , How down the Alt key and then select area you would like to select.

How to Select and Edit Vertical Blocks in SSMS - SQL Server Tutorial

Once the area is selected, Type the new word you would like to use, in our case we want to replace with TestDB2.
How to Select and Replace vertically in SSMS - SQL Server Tutorial

I noticed one thing, If there will be space( line) between the queries, It will type the new word there as well. that is annoying so make sure your queries don't have space between them.

Trying to add word to blank lines as part of replace in SSMS vertical Select and Replace Feature


  1. They provide additional feedback and ux firms are willing to work with clients to improve outcomes whenever possible.

  2. Their advice helped determine which features were most important.
    logo creation companies

  3. Thanks for compiling such nicest information in your blogs. Articles are very informative and hope again I’ll find more like that.
    logo companies designer

  4. I’m eager to find the valuable information and for me this is the right place to get the good stuff.
    digital web agencies

  5. Proficient distributers will clean up their photos before the real distributing.
    eCommerce Product Photo Editing Service

  6. They simplify photo editing by assisting the client with changing their photo with a dash of a button.
    Product Photo Editing