I dunno. Grabbing some queries I've written, I find:
select db_name (u.dbid), sum (2 * u.size), sum (2 * curunreservedpgs (u.dbid, u.lstart, unreservedpgs +)) from sysusages u, sysdevices d, sysdatabases db where d.low <= u.vstart and d.high >= u.vstart + u.size - 1 and d.status & 2 = 2 and u.segmap & 4 = 4 and not (u.segmap & 2 = 2 or u.segmap & 1 = 1) and u.dbid = db.dbid and db.name not like "dbcc_%" group by u.dbid
I wonder whether that's really going to look better using some kind of interface to an SQL query builder. I'm afraid it would get worse.

You know, when I started working with SQL, I made myself such a function, I'd pass it a table name, fields, possible other information, and it build an SQL query for me. But soon I found that for anything that isn't a trivial select, writing the SQL yourself was far easier and gave cleaner code.

-- Abigail


In reply to Re: Leashing DBI by Abigail
in thread Leashing DBI by billyak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.