SQLServerCentral Article

Custom SSMS Shortcuts for ETL Developer. Part 1: SELECT in a Keystroke

,

You can save up to 90% of your time if you invoke the most commonly used SQL query, SELECT FROM, with a keyboard shortcut strike. To apply this simple but often overlooked technique, first assign a keyboard shortcut to the query in SQL Server Management Studio.

1. Create a Stored Procedure for SELECT Statement

Execute the following code to create a stored procedure:

CREATE PROCEDURE dbo.sp_select
  @tablename NVARCHAR(200)
AS
DECLARE @cmd NVARCHAR (255)

SET @cmd = 'SELECT TOP 50 * from ' + @tablename
EXEC sp_executesql @cmd
GO

Limiting the result set to a few top records minimizes impact on performance.

2. Create a Keyboard Accelerator for a Stored Procedure

To create a keyboard accelerator for a stored procedure:

  1. On the Tools menu, click Options.
  2. On the Keyboard page, select Ctrl+F1 or other unused keyboard combination in the Shortcut list.
  3. In the Stored Procedure box, type the stored procedure name sp_select, and then click OK.

SSMS Tools/Options dialog box keyboard shortcut mapping

Note. You need to close SSMS and re-open it to make the shortcut setting effective.

3. Get SELECT Query Results with a Keyboard Shortcut Stroke

To execute SELECT statement with a keyboard shortcut:

SELECT query result set

Tip: This technique is the most beneficial during data analysis phase of an ETL project, when you need to look up and analyze content of hundreds of source tables. When typing 'SELECT TOP 100 * FROM <table name>' takes about 10 seconds, calling this query with a keyboard shortcut can take only 1 second and avoids spelling errors. This makes you 9 times more productive! Make use of this technique a habit for all your table content queries and impress your manager and peers with your efficiency!

Rate

3.75 (36)

You rated this post out of 5. Change rating

Share

Share

Rate

3.75 (36)

You rated this post out of 5. Change rating