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

  • Thanks for all the good suggestions.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I second the shout for ssms tools. Snippets is the best feature. Spend a bit of time putting in all those short/medium length snippets of code and (as long as you remember the shortcuts) work is quicker and easier. Things like declaring/setting different types of variables, e.g. Type "di" + space to get DECLARE @ int

    Set @ = , ready for me to fill in the variable name and value. These dont necessarily save huge amounts of time but they do improve accuracy. I have a colleague who types all queries out by hand and the number of times a query won't run because he typed WEHRE or SELETC.

    The other lifesaver in ssms tools is the query execution history. Ever have that super complicated query that took ages to write and then ssms crashed? Or you closed the window without saving? Ssms tools saves the full contents of very query you ever run. And that's just two ofthe features.

  • Thanks aphillippe, that's a good one.

    Here is another one that comes in quite handy for me:

    SDF (Select Distinct From) which outputs:

    SELECT DISTINCT

    FROM

    Would be great if there was some sort of snippet repository for this. I'll have to suggest to Mladen to add one to his site. 🙂

    I also really enjoy the Window Connection Coloring options. I use a fair number of servers in my job and having each one automatically in a different color in the query window is great. I wish this was available for each individual database as well.

  • So how would you do something like:

    Select * From Sales Where CustomerType = ? Order By LastUpdate Desc

    without the benefit of the SSMS Tool Pack?

    Ken

  • Before I found SSMS Tools I created this keyboard shortcut:

    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;

    With that strung all on 1 line as my Ctrl+7, I use it after a database restore to look for orphaned users.

    It produces 1 line for each orphan, which can be copied into the query window & executed. The lines it produces look like:

    exec sp_change_users_login 'update_one', 'User_Test','User_Test';

Viewing 5 posts - 31 through 34 (of 34 total)

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