How can I run just the statement my cursor is on in SQL Server Management Studio?

后端 未结 24 661
夕颜
夕颜 2020-12-04 17:19

As a long time Toad for Oracle user, I have gotten used to hitting Ctrl+Enter and having just the statement under the cursor be executed.

In SQL Server Management St

24条回答
  •  眼角桃花
    2020-12-04 17:39

    To run just a section of a larger script, try this ..

    Steps:

    1. Collapse the SQL statement you want to run by clicking the minus sign in the left margin next to the statement. That will show only the first line (with an ellipsis "..." to indicate more code not shown) and the ending ";" for the statement.

    2. Highlight the line.

    3. Press [F5] key.

    That will run just the highlighted statement. If you want to run more than the one statement at a time, collapse each statement and highlight all that you want to run, then click [F5]. It's a work-around, but still much easier than having to drag and highlight numerous lines of code every time.

提交回复
热议问题