Mo D Genesis
Mo D Genesis

Reputation: 6159

shortcut for fetching data from the object explorer tab in sql server management studio

enter image description here

It's annoying to do two clicks every time I want to fetch some data. is there a shortcut?

This is not the same as How can I program a keyboard shortcut to select top 1000* from selected table?

I DO NOT WANT TO WRITE A TABLENAME IN A NEW QUERY, I want to select a table in object explorer and then doing a key combo to fetch me the query I want.

It's like how the delete button works but I want another keystroke that will give me the data.

BEFORE CONSIDERING THIS A DUPLICATE: Maybe read better before duplicating this question as this is clearly not the same as the other one. Do not just read titles but read contexts.

Upvotes: 0

Views: 856

Answers (2)

Mo D Genesis
Mo D Genesis

Reputation: 6159

At the object explorer tab: Hit right click on the table and then press 'w' on your keyboard.

When you are searching for a database through your keyboard, hit context menu on your key then press 'w'.

Special thanks to https://stackoverflow.com/users/4137916/jeroen-mostert

Upvotes: 1

dfundako
dfundako

Reputation: 8324

If you want to totally stay away from the object explorer, make a proc that selects top 1000 and bind it to a shortcut.

CREATE PROCEDURE sp_selecttop1000
@tablename SYSNAME
AS
BEGIN
DECLARE @query NVARCHAR(4000)
SET @query = N'SELECT TOP 1000 * FROM ' + @tablename
END
GO 

Now go to Tools, Options, Keyboard(expand this), Query Shortcuts. Now pick an unused binding, add sp_selecttop1000 to it, restart SSMS.

Now you can highlight a table in the query window, and use the keyboard shortcut to select top 1000 from the highlighted table.

Upvotes: 0

Related Questions