Query Analyzer Tricks

  • A general question I have about the JOIN comments above - Since INNER is the default, why is that you are explicitly using INNER with JOIN? Is that for performance or just habit?

    Thanks,

    Angie

  • ANSI standard. and habit. Helps to clarify for me. You can drop it if you wish.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • Self-documenting code is always good.

  • I've gone back and forth on documenting code and I've kind of some to the conclusion that if someone is reading my object code (in SQL), I've got to assume a fair amount of knowledge. Can't explain that I'm joining customers to orders to get the number of orders based on the customerid. That's got to be obvious if you're at this level.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • Good point, although I was referring to code that documents itself, not external comments.

    But since you brought it up, I've wrestled with the same question time after time, and come to more or less the same conclusion. However, there has to enough comments to quickly provide the frantic problem-solver with the magic ingredients: context and rationale.

  • To replace field list commas with ,^P I

    use notetab from http://www.notetab.com/

    Its small, inexpensive (I think there is a free version of it) and it can be scripted. I've got it setup where I cut from QA - paste in notetab - press a hotkey and its back in my clipboard properly formatted.

    Doug

  • Interesting. I'll have to check it out. I use EditPlus (www.editplus.com) for most non SQL editing. I like the color coding and tabbed interface, but Notetab looks nice.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • For Steve Jones an email reply I received from Microsoft....

    "Yukon will include Microsoft's IntelliSense auto-complete technology and its Visual SourceSafe source code control system.

    I guess your wish is granted 🙂

    -joe

    Joe Xavier

    Program Manager, SQL Server

    Microsoft Corporation"

  • One of my most favorite undocumented things in query analyzer is the object browser, and the fact that if you drill down to the table or view and drag and drop the "columns" are onto the browser window all, the columns available in the table/view will show up. I love this as I have some long tables that I need all but 2 fields returned and with this I can drag, drop and delete the 2 instead of typing out all, or drag and dropping individually.

  • Thank you for that tip - I just tried this and think it is pretty neat - to all readers out there who hesitate to send something in because they think it might be commonly known & used - please remember that just because you use something all the time is no reason to believe that everyone else does as well -

    I love this website!!!







    **ASCII stupid question, get a stupid ANSI !!!**

  • Thanks for the tips and complement and I am looking forward to Intellisense. Save me some BOL time trying to remember which order parameters are in.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • Thanks for the article. As a previous post put it, you tend to work w/ the same tool over and over, and forget to play around with some of the new features.

    I especially liked the idea of working w/ templates. I have been doing something similar since the SQL7 QA days which still works great for my needs. I have a sql file (scratch.sql) that contains all of my commonly used code like attaching/detaching, backup, restore, sp_helpdb 'dbname', etc. I load this file every time I load QA by adding the sql file pathname after the Target in the shortcut. The only downside was when I launched another .sql file w/out QA being open, I would not get my default sql files. Therefore, I like the template idea so your objects are always exposed.

    Thanks and keep up the great work!

  • Am confused. Are ANY of these tips supposed to work with version 7.00?

    I sure cant make them happen.

  • Another very useful editor with great find and replace tool (and regular expressions) is the freeware program Notetab Lite http://www.notetab.com. I use it all the time, very handy for formatting data from 'legacy' data sources into appropriate CSV formats for import into SQL.

    Alex

Viewing 15 posts - 16 through 30 (of 54 total)

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