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:
--@DELETE FROM ORDERDETAIL
--DELETE FROM ORDER
--DELETE FROM PRODUCT
--DELETE FROM PRODUCTCATEGORY
--DELETE FROM CUSTOMER #
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).