The Best Kept Secret About SQL Query Analyzer

  • I still rated it as excellent, even though it was a bit inflated.  It was instantly helpful to me, and once I've seen the agonizing detail, I decide for myself what shortcuts I take.

    Thanks for the tip.

  • Am I missing something?  This was originally published back in October '05.  I recognized it from all the hubbub that was written in the forums the first time around about how it's not really a secret.  I'm kinda wondering why it was republished... did something change from the original article?  Is SSC running out of articles to post?  Why, oh, why did this article get top billing twice?

    A bit puzzled but not as annoyed as the above paragraph makes me sound, 

    ~Julie~

  • Thank you, I did not know this.

    I also know other experienced developers who were not aware of this.

     

  • Well, I've been using Query Analyzer since 1998 and never knew this trick, so I'm very happy!

    Things like this can be extraordinarily useful to people who aren't aware of them. I still get surprised happy expressions from experienced Access developers when I go through some of the shortcut keys (e.g., CTL-semicolon inserts the current date in a field - this works in EM as well!)

    A few years ago, I watched a friend of mine doing something in Query Analyzer and as he switched between several QA windows, I suddenly noticed he hadn't used the mouse to go to the "Window" menu - after 10 years of using Windows, and now an experienced VB, ASP, SQL Server developer, I had never learned about CTL-TAB!

    So you never know...

    Well Yakov, your name may be Schlafman ("sleeping man",) but you sure woke me up on this one- Thanks!  I give you my own personal Maven Of The Day award!

    -- SteveR

  • Grasshopper's post was spot on.  That was a clever way to do this, and is going to save me a lot of time.  Thank you.  I just saved the xl part as a macro (and I use | as my delimiter).  Well done.  And I rated the article poorly b/c this was hardly a secret, and is very similar to how I was doing it before, and I'm just a novice with SQL.
     
    Again, thank you Grasshopper.
  • Or of course you can just paste your query into EM and run it.  Select all the results and paste to Excel along with the column headers.

     

  • Steve Rosenbach,

    Thank you so much for the helpful information.  I never knew about the CTRL-TAB switching windows in QA or that CTRL + ; inserts the current date in a field.

    I love forums that have "secrets" discussed.  Many things may not be secrets to many people who read the forum, but for others it will be the best info going.  Many times people get so used to doing things one way or that is the way they learned it that they don't realize there is a better way until reading the forums.  I work with many developers at my company and many times I find a tidbit of info on these forums that may be very obvious to some but is brand new to me and the fellow developers I share it with.  So, keep the "secrets" coming I say.

    One of my favorite keyboard shortcuts is CTRL+SHIFT+C to comment out a block of highlighted Code in QA and CTRL+SHIFT+R to uncomment it.

    Thanks again to all who posted tips though they may have seemed obvious.  Keep posting it will help someone.

    John

  • Be careful when using tab delimited and columns (like postcodes) that could start with a zero.

    Excel automatically drops the zeros when you import the data.

    A better solution is to use "results to text" , custom delimiter (and then something like ¬ (it probably won't be in your data).

    Run the query, then paste results into Excel, and use the "Text to columns" function in Excel, then delimited, Other (and enter the same symbol as above).

    It will then break the data into columns using the symbol as the seperator,  click Next, then choose "Text" format, (not General) for any columns with data that might begin with a zero.

    You can also handle dates in the same way

  • I've really enjoyed reading all of these posts and think that the article's title deserves 10/10 for marketing alone!  The amount of information contained in the forum is fantastic.  IMO it doesn't matter that this may have been posted in the past because not everyone has read every article that has been published and this may not be the sort of thing you go searching for, especially if you already have an alternative method.

    I already knew about the Query Analyzer settings to facilitate moving query data to Excel but didn't know about the EM equivalent.  Copying and pasting the query statement into a New View window in EM always gives you the column headers and you don't have to keep changing your Query Analyzer settings so this works best for me.  There's also no footer "rows affected" text using this option, so I haven't found anything wrong with it yet.

  • This ia hardly "The best kept secret "  

  • I've been using that technique for years, if I knew it was a secret I would have let it out of the bag. Damn handy though I thought everyone knew that one.

    Maybe "Best kept secret for people who starting using QA yesterday evening"?

    Hmmm....

     

     

  • excelent

  • Thanks. I have probably stumbled onto a version of one of the methods before, but I appreciate your taking the time to write it down so others can keep it on file.

    I think Microsoft must have heard this request a million times, because Management Studio in SQL Server 2005 has the option "Include column headers when copying or saving the results." That one checkbox would save a lot of grief in Query Analyzer.

    🙂

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

  • Why not just use Microsoft Query and an ODBC source?

  • LOL

Viewing 15 posts - 76 through 90 (of 94 total)

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