It happens more often than I like to admit, but I was asked a question about Toad that I could not figure out. A co-worker was trying to help a customer emulate a SSMS feature – the ability to program stored procedures to a keyboard shortcut or keystroke sequence.
I got part of the way there – Code Snippets. These can be customized and programmed by the end user to call frequently bits of code or scripts on demand. What I was missing was how to assign a keyboard shortcut to each snippet. Of course it was staring at me right in the face.
Thankfully @kekline put my nose in it in such a way I could not miss it – thanks Kevin! So just in case the rest of you are wondering how to do this, here’s a step-by-step:
How Microsoft SQL Server Management Studio (SSMS) Does It
How Toad Does It
Toad ships with several dozen code snippets. You can invoke them by using a right-click in the editor, or you can assign a keyboard shortcut to each of them as you see fit.
To see all the Code Snippets, open them on the menu View – Code Snippets. I am going to create a new snippet group called SSMS.
All Right, Let’s Do This Already!
In the editor, to invoke the snippet, type the name and use the Ctrl+Spacebar key sequence. You then need to use F5 to execute it.
So in the above example, here is what I type:
‘who’ followed by ‘Ctrl+Spacebar’
Toad places the code into the editor. I can then edit or execute it as I require.
That’s an extra keystroke over what SSMS requires. However, you do get to see the code used, and you have the ability to create an unlimited number of SPs you want to code into Toad. I think that is a fair tradeoff.