Productivity Keyboard Shortcuts

  • Comments posted to this topic are about the item Productivity Keyboard Shortcuts

  • Awesome!

    I'm using SqlComplete and SqlCodeGuard and QuickMacros but this fills a hole left by those products.

    Thank You.

  • You can use,

    ctrl + 6 for : select * from tablename

    ctrl + 7 for : select count(*) from tablename

  • For some queries/utility we can avoid dependency of this type of util procedure by writing query directly.


    for ctrl + 7 write : select count(*) from

    now for any database connected in SSMS we can fire count command by press ctrl + 7 for selected table/view name.

    by the way, your util procedure & its usage trick is awesome.


  • Here are my assignments if it helps you decide what to do with your open slots:

    CRTL+1: sp_who

    CRTL+2: sp_lock

    CRTL+3: sp_who2

    CRTL+4: sp_spaceused

    CRTL+5: sp_monitor

    CRTL+6: sp_tables

    CRTL+7: sp_columns

    CRTL+8: sp_stored_procedures

    CRTL+9: sp_helptext

    CRTL+0: select * from

    I am Melvis.

  • We still have quite a few Sql Server login accounts and with frequent copying & restoring, have to deal with orphaned users. I assign this script to Ctrl+0. After restoring a db I start a new query in that db then hit Ctrl+0.

    The Select produces the "sp_change_users_login" statements for any orphans. I like to see what is produced & then copy / paste into the query window for executing.

    Declare @usrs as Table ([usr] [varchar](50) NULL,[usid] [varbinary](250) NULL);insert @usrs execute sp_change_users_login 'Report';select 'exec sp_change_users_login ''update_one'', ' + '''' + usr + ''',' +'''' + usr + ''';' from @usrs;


    DECLARE @usrs AS TABLE (

    [usr] [varchar](50) NULL,

    [usid] [varbinary](250) NULL


    INSERT @usrs

    EXECUTE sp_change_users_login 'Report';

    SELECT 'exec sp_change_users_login ''update_one'', ' + '''' + usr + ''',' + '''' + usr + ''';'

    FROM @usrs;

  • Does not work. Your Declare statements are missing the @Object and @AddParam parameters.

  • this is great utility code. Can I share it on some wikis that I use?

    412-977-3526 call/text

  • Hi Robert, sure you can, I have updated version of it, not sure why the old one is posted. I'll attach it soon

  • craig

    thats the whole point you have to make a selection in the text editor

  • I get an error:

    Procedure or function 'Utils' expects parameter '@Object', which was not supplied.

  • Make a selection in text editor (ex: highlight a table name and press ctrl+3)

  • Thanks. I've done similar things with my shortcuts too.

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply