x

SSMS Shortcut Keys

What is your favourite shortcut key for SSMS?

One shortcut per answer please

more ▼

asked Oct 15 '09 at 09:03 AM in Default

thatismatt gravatar image

thatismatt ♦♦
210 7 8 9

Excellent question.
Nov 04 '09 at 09:31 AM John Sansom
(comments are locked)
10|1200 characters needed characters left

24 answers: sort voted first

ALT+X to execute batches, but I am trying to move to CTRL+E

However CTRL+K, CTRL+U or CTRL+K, CTRL+C for commenting/uncommenting are way up there for me as well.

more ▼

answered Oct 15 '09 at 04:56 PM

Steve Jones - Editor gravatar image

Steve Jones - Editor ♦♦
5.1k 76 79 82

(comments are locked)
10|1200 characters needed characters left

Save Save Save (even if there's auto-save ON, please save)

CONTROL S

more ▼

answered Oct 17 '09 at 07:10 PM

Raj More gravatar image

Raj More
1.7k 77 82 84

I can't mod this up enough! I remember doing some development using Crystal Reports. It was even more the case that you needed to save all the time with that software! I think we basically got RSI from saving so frequently.
Oct 19 '09 at 08:57 AM Melvyn Harbour 1 ♦♦
(comments are locked)
10|1200 characters needed characters left

If you go to Tools/Options/Environment/Keyboard you can associate your own stored procedures to shortcut combinations. For example if you often need to select the top five rows of a table, add this to master and associate a keyboard combination in the options with the stored procedure. You'll have to open a new query window for the changes to take effect. The cool thing here is that any selected text is passed in as a parameter to the associated stored procedure.

CREATE PROCEDURE sp_select_top5 @table varchar(8000) AS BEGIN  declare @dynamicSQL varchar(8000)  set @dynamicSQL = 'select top 5 * from ' + @table  exec(@dynamicSQL);
END
more ▼

answered Oct 27 '09 at 09:24 AM

David Atkinson gravatar image

David Atkinson
317 12 18 21

I love these user-defined shortcuts. You can actually just use "SELECT TOP 5 * FROM " and skip the stored procedure and dynamically generated SQL (See the out of the box query for Ctrl+5)
Nov 04 '09 at 11:04 AM KenJ
Nice. Seems obvious now that you mention it! :)
Nov 12 '09 at 03:09 AM David Atkinson
(comments are locked)
10|1200 characters needed characters left

Ctrl + N - New Query

more ▼

answered Oct 15 '09 at 09:11 AM

thatismatt gravatar image

thatismatt ♦♦
210 7 8 9

(comments are locked)
10|1200 characters needed characters left

Ctrl + R to close the results window

more ▼

answered Oct 15 '09 at 09:12 AM

Jay Bonk gravatar image

Jay Bonk
1.4k 2

That's probably my favorite at the moment. For large result sets, I'll make the result pane fill 90% of the window and then toggle it with CTRL-R.
Nov 06 '09 at 01:28 AM Tom Staab
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x123
x21
x4
x3
x1

asked: Oct 15 '09 at 09:03 AM

Seen: 5437 times

Last Updated: Mar 12 '12 at 12:26 AM