SSMS: keyboard shortcut to execute current row?

11,591

Solution 1

Highlighting the text beforehand, i.e. by clicking the combination Home, Shift + End, F5 would appear to be the only option.

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

Solution 2

The add-in SQL Complete has this exact feature. Execute current statement using a hotkey without selecting it. Their free express version has it, but I also recommend standard version for its additional features. It's a major time-saver.

Solution 3

https://connect.microsoft.com/SQLServer/feedback/details/125200/execute-current-statement is a Connect issue on this - Guess it's a low priority.

I've just gotten used to using standard keyboard shortcuts. One such is to (if for example the query i want to work with is written in the end) select everything before this query using ctrl-shift-home, then ctrl-k, ctrl-c to comment this out, hit end, then f5. once i need to get all back i just ctrl-a then ctrl-k,ctrl-u to uncomment again.

In either case, it helps being familiar with the keyboard :)

Solution 4

I know of 2 shortcuts that will perform the Execute, but if you have more SQL statements within the SQL file, it will execute them all unless you highlight the line you want.

F5 ctrl+E

Share:
11,591
tesmp
Author by

tesmp

Updated on June 04, 2022

Comments

  • tesmp
    tesmp almost 2 years

    SQL Server Management Studio: Is there a way to execute current row (keyboard shortcut) without highlighting it?

  • tesmp
    tesmp about 13 years
    Yes, I know these, but I want a shortcut which will execute only the current line without a need to highlight it.
  • Neil Knight
    Neil Knight about 13 years
    I don't think there is one. Sorry.
  • tesmp
    tesmp about 13 years
    Thanks for the info. I'll have to get used to your suggestion, until they will get this funcitonality into SSMS
  • ThePatelGuy
    ThePatelGuy about 8 years
    What if the cursor is not at the end of the statement?