10

In Visual Studio 2010, I have a Database Project. I can use this without issue to view, edit, create sprocs, etc.

How can I change the keyboard to allow me to use an F key for "execute sql" as I would use F5 in MSSMS. I can't seem to find the right binding sequence in Tools-Options-Keyboards and figured it would be faster to ask the community, so I can focus on writing code atm.

Much obliged. (And yes, I admit I'm being lazy, but my googlefu has given up the ghost this morning and I'm just curious, it's not stopping me)

3 Answers 3

14

For VS 2013 and VS 2015

Command I found to work was SQL.TSqlEditorExecuteQuery

I use F5 as shortcut but remember use drop-down 'Use new shortcut in' = Microsoft Sql Server Data Tools, T-SQL Editor

Some steps:

  1. Go to Tools > Options > Environment > Keyboard
  2. Go to SQL.TSqlEditorExecuteQuery

Hint: Paste it into the "Show Commands Containing" textbox because it is a long list.

  1. Set 'Use new shortcut in' to Microsoft Sql Server Data Tools, T-SQL Editor

This way F5 will still keep the same behavior when coding C# etc.

  1. Click in 'Press shortcut keys' and hit the F5 key
  2. Click Assign (required)
  3. Click Ok.

enter image description here

6

I was having the same issue... I also bound F5 to QueryDesigner.ExecuteSQL. No go. Then I bound F5 to Data.SqlEditorExecuteSQL. Still no go... But then I unbound F5 from QueryDesigner.ExecuteSQL and it worked... now I can hit F5 and execute a query. I was worried there for a bit.

Screenshot
Screenshot

0
1

Tools>Options > Keyboard > QueryDesigner.ExecuteSQL > Create new short Cut

3
  • Ok, what's the trick? I'm not getting my new keyboard shortcuts to cause that command to kick off. I've tried assigning it to a global F3 (because I don't ever use it, even though I know what it is for) after I removed that from Find Again and I know there's nothing else associated to it. It's still not executing. ~ Thoughts ideas?
    – jcolebrand
    Jul 29, 2010 at 16:41
  • @drachenstern you say that you're able to view, edit, create sprocs, etc. are you actually able to execute? I mean in some way other than a keyboard shortcut? MSDN has this: msdn.microsoft.com/en-us/library/yea4bc1b(vs.80).aspx
    – xdumaine
    Jul 29, 2010 at 17:58
  • Yes I can run the scripts if I click the button on the toolbar. I can also run the scripts by going to the Data menu and clicking Transact-Sql Editor, then Execute SQL. I just want to assign it to a keystroke. Something tells me I'm missing something really obvious.
    – jcolebrand
    Jul 29, 2010 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.