Execute a Block of Text in SQL Server Management Studio

Execute a Block of Text in SQL Server Management Studio

In SQL Server Management Studio, you can use the Alt key in your keyboard to select blocks of text to execute. For instance, suppose you have the following statements:


You’d place the cursor where the @ symbol is, press and hold the Alt key, left click with the mouse, and drag the cursor all the way to where the # symbol is. The @ and # symbol are included here to show you the exact places, they shouldn’t be included in your statement. Also keep in mind that this selection method creates a rectangle so you have to select everything to cover the longest statement.

Note how you have to drag the cursor all the way to the # symbol even when the last word was CUSTOMER. This is because Alt-dragging creates a rectangle of marked text, and you need to make the rectangle wide enoungh to select the fourth line (the longest one).

See also  5 Tips to Manage a Remote Workforce

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist