Think that how many times you write “SELECT * FROM” a day.
You can select data from a table with one key Ctrl+5
Let’s create an SP under master DB. If this SP is under master DB, we can use shortcut property in all DBs.
USE master
CREATE proc sp_select
@TABLE_NAME VARCHAR(100),
@COUNT VARCHAR(10) = NULL
AS
BEGIN
IF EXISTS (SELECT NULL FROM sys.objects WHERE TYPE IN ('U','V') AND name=@TABLE_NAME)
BEGIN
IF @COUNT IS NULL
SET @COUNT=1000
EXEC('select top ' + @COUNT + ' * from ' + @TABLE_NAME + '(nolock)')
END
ELSE
print 'Table not found.'
END
GO |
bbb
SP is created, now we have to assign shortcut to this Stored Procedure; Tools > Options > Environment > Keyboard

We assigned “Ctrl+5” to sp_select as seen in the picture above.
Now, just write table or view name, select the text and hit Ctrl+5.
MY_TABLE_NAME --Selects TOP 1000 |
or
MY_TABLE_NAME, 50 --Selects TOP 50 |