How can I execute a single query in SQL Server Management Studio?

Viewed 70883

Background: I'm using SQL Server Management Studio 2008 and I have a query window open that contains multiple queries.

Is there a keyboard shortcut that will allow me to execute a single query without highlighting the query I would like to run first? Some other SQL tools have shorcuts that run the query that is under the cursor, which keeps the hands on the keyboard, and away from the mouse.

11 Answers

A new version of SSMS is in development by Microsoft (kind of new version) it's called SQL Operations Studio.

With SOS (haha) you can hit Ctrl+F5, or — like me — replace the shortcut to Ctrl+Enter

SQL Server Management Studio don't have the feature to execute single SQL statement from the SQL script editor. even we create different shortcut still it doesn't work as we want.

I found a alterative for SQL Server Management Studio => DBeaver , community version is free.

  1. Download DBeaver
  2. Select SQL server option to connect
  3. Download connector if not already installed(Auto suggest, popup will come)
  4. Shortcut to execute SQL statement/Single line query -> Ctl + Enter
  5. To execute SQL script -> Alt + X

Ctrl k + u will high lite text f5 to run

Related