in reply to Leashing DBI
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.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
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
|
|---|