Home Forums SQL Server 2008 SQL Server Newbies How Do You Keep The "Pieces" Of A Complex Statement "Organized" RE: How Do You Keep The "Pieces" Of A Complex Statement "Organized"

  • First! Thank you all for taking the time to reply. I appreciate all the feedback.

    A little background about me and my situation. We have a 3rd party ERP system, SQL Server based. My primary job is to use Access to develop reports. Since starting I have added dumping data/information into Excel, which is becoming more and more frequent. No formal SQL Server or SQL education, all via books and the internet - like SQL Server Central. I'm at a stage where I am using more and more Pass Through Queries in Access. Along with that I find I start solving most query problems by using SSMS instead of Access Query Design. Especially when the request is one of those ad hoc ones for the results in Excel.

    This "little project" was a customer request that got modified after I gave them a 1st pass. The problem I encountered was the statement was on so many lines I had to scroll up and down to select parts and selected at wrong points. Then I would have to start over - good thing I keep a copy of the last good statement. :crazy:

    Sean - Regarding the CAST and VARCHAR(7). I know the values will not exceed 48.999 and the decimal will be in 1/8's of an inch increment. So, I guess 5,3 would have been "better". I perked up reading your comment - I visualized that it 'jumped out at you'. That's Cool! 🙂

    J - I wasn't asking about the formatting, per se, except that I do realize it does make a big difference in readability, which is a first step of the answer to my question. I've been using Instant SQL Formatter, considering purchasing Pretty Printer. Thanks for the tip about ApexSQL. I'll add that to my list of candidates.

    Jeff - Comments embedded in the statement. Sheesh! (To myself) It never occurred to me.

    Breaking up code - this will be new territory for me. Do you (anyone reading this) have any suggested reading materials? Either internet or books. There's a statement on my resume that's so true, "The road to success is always under construction."

    Paul - Thanks for echoing support to Jeff's comments. It's good to hear when someone does that - seems to drive the point home.

    Again, thanks everyone for your help!

    [font="Verdana"]"The Road To Success Is Always Under Construction."[/font]