Jun 7, 2011

Table and Stored Procedure helptext using Keyboard - SQL Server Keyboard Shortcut


In the world of programming keyboard shortcuts are very useful for fast developing either in SQL server, DotNet or any programming language or any database.
In my project I always use SQL Server for backend and for editing or viewing SP or Database Table structure I used right click on Database object and then select either design as Figure 1 or modify as Figure 2 option. But it’s little bit lengthy procedure for getting a result.

Figure 1

Figure 2
So I was searching for shortcuts using that we can easily get the desire result and I found that.
How to do that for Table?
In my Sample Database there is one table Customer_Orders. Just  drag that table to query window or copy the name of table and paste it to query window. Then select it and just press Alt+F1 it’s default from Management Studio and it will show each and every details in result area like Figure 3.


 Figure 3

How to do that for Sps?
In my Sample Database there is one Sp getAllOrders. Just  drag that sp to query window or copy the name of sp and paste it to query window.  Append sp_helptext at the beginning of the sp name with space and select all and press F5 key and it will show the result in below pane.
Still it’s required 2 to 3 actions so set some default key for sp_helptext command using below steps.
Step 1 Go to Toolsà Options menu like Figure 4

Figure 4
In Figure 4 from left panel select keyboard option and from right side Ctrl+F1 has empty table cell. Add sp_helptext command there and press ok. Here you can set some keyboard shortcuts if you want like Ctrl+F2, Ctrl + F3 and more
Now open new query window drag sp name on query window and select it and press Ctrl+F1 and you can see result like Figure 5.

Figure 5


Figure 6
Above Figure 5 and Figure 6 both are same but still there is a little and important difference so let me take an opportunity to explain that difference. In Figure 5 the result is displaying in grid and in Figure 6 result is displaying as a plain text. If you check at the top then there is tooltip in yellow strip with text Results to Grid and Results to Text. Both options are at the top of the query window. If you see the result in grid view then you will loose the formation of the sp like indentation, spacing, beautify etc. But if you view result in plain text format then it will preserve all the format when you have created or modified sp.


1 comments:

ishtiaq khan

it was help full

Post a Comment

Author Profile

Total Pageviews

Categories

Followers

 

Sponsors