Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««678910»»

The Best Kept Secret About SQL Query Analyzer Expand / Collapse
Author
Message
Posted Friday, January 27, 2006 3:42 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, February 13, 2007 1:33 PM
Points: 45, Visits: 1

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.

 

Post #254238
Posted Friday, January 27, 2006 4:58 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 1:51 PM
Points: 937, Visits: 1,730

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

Post #254250
Posted Monday, January 30, 2006 1:12 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 22, 2013 3:09 AM
Points: 211, Visits: 30

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




Post #254351
Posted Monday, January 30, 2006 4:44 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, September 07, 2007 1:13 AM
Points: 30, Visits: 1

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.

Post #254369
Posted Friday, March 03, 2006 1:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, February 24, 2007 2:04 AM
Points: 1, Visits: 1
This ia hardly "The best kept secret "  
Post #263009
Posted Saturday, September 02, 2006 8:22 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, February 04, 2014 10:25 AM
Points: 10, Visits: 14

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....

 

 




Post #305822
Posted Wednesday, January 03, 2007 5:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 12, 2014 2:43 AM
Points: 4, Visits: 24
excelent
Post #333979
Posted Monday, January 29, 2007 7:52 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:24 PM
Points: 2,290, Visits: 2,544
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.



-------------------
"Operator! Give me the number for 911!" - Homer Simpson

"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
Post #340472
Posted Monday, January 29, 2007 12:59 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 07, 2007 6:34 AM
Points: 1, Visits: 1
Why not just use Microsoft Query and an ODBC source?
Post #340611
Posted Tuesday, January 30, 2007 11:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 27, 2008 11:37 PM
Points: 1, Visits: 3
LOL
Post #340969
« Prev Topic | Next Topic »

Add to briefcase «««678910»»

Permissions Expand / Collapse