Sql-server – How to execute a single query in SQL Server Management Studio

keyboard shortcutssql serverssms

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.

Best Answer

I did some searching and was unable to find any keyboard shortcuts for executing individual lines in SSMS. There is a reference online though.

http://msdn.microsoft.com/en-us/library/ms174205.aspx

Personally I just highlight the row in question (Shift + End or Shift + , etc.) and hit F5.

Ctrl + E works just as well on a Mac.