Geeky Guy
Geeky Guy

Reputation: 9399

Execute sp_helptext from keyboard shortcut on Visual Studio

I use SQL Server Management Studio. One of the time-saving features that helps me a lot they way you can set new keyboard shortcuts. I've set a combination of keys to execute sp_helptext, so I can select the name of a stored procedure and see its definition on the results pane.

I am trying to use Visual Studio (2013 pro) now to work on my SQL code. I can't find any way to set new key combinations like I do in SSMS.

Is it possible to set a shortcut for sp_helptext in VS? How can I do it?

Upvotes: 3

Views: 11423

Answers (2)

user1111
user1111

Reputation: 2020

This Visual Studio Extension is the one you are looking for.

Added some extra commands for Visual Studio SQL editor under the menu "SQL", so you can do the same things as with SQL Server Management Studio. For example, select the table name, then press the shortcut key, it will run "exec sp_help tableName".

  • To run sp_help, press "Alt + 2";
  • To run sp_helpText, press "Alt+ 3";
  • To search for tables by the table name, press "Alt+ 4";
  • To search for tables by the column name, press "Alt+ 5";
  • To search for dependencies, press "Alt+ 6";
  • To search for stored procedures, press "Alt+ 7";
  • To run "Select * from table", press "Alt+ 0";

Crollan's SQL Server Management Studio addIn - Crollan SQL Auto Complete, has lots of other powerful features. One of them is to automatically find out the potential ways to join tables. The addIn can be found on

https://visualstudiogallery.msdn.microsoft.com/bf161b31-0826-4f07-905b-d5d09c1227bb or

Crollan.com

Upvotes: 1

Geeky Guy
Geeky Guy

Reputation: 9399

In the end what worked was getting all the stored procedures text in .sql files in Visual Studio. This way, if I have a piece of C# code that looks anything like the example below:

SqlCommand command = new SqlCommand("SAMPLE_PROCEDURE", someConnection); // snip

I can select the name of the stored procedure (in this case, SAMPLE_PROCEDURE), hit CTRL + ,, and then the corresponding .sql file will automatically be opened in a new tab.

Upvotes: 1

Related Questions