How do I write a query that takes information in a table formatted like so:
DataID Date ServerID DriveVolume DriveLetter DriveSize SizeID DriveFree FreeID FreePercent
1308 9/20/2006 12:00 myserver1 Blank C: 16.41 GB 6.58 GB 40.07
1309 9/20/2006 12:00 myserver1 New Volume E: 6.14 GB 4.07 GB 66.21
1310 9/20/2006 12:00 myserver1 New Volume F: 12.92 GB 7.84 GB 60.66
1311 9/20/2006 12:00 myserver1 EXCH-STG1-TLOG I: 30.72 GB 28.83 GB 93.84
1312 9/20/2006 12:00 myserver1 EXCH-STG2-TLOG J: 30.72 GB 28.43 GB 92.55
1313 9/20/2006 12:00 myserver1 EXCH-STG3-TLOG K: 30.72 GB 29.16 GB 94.93
1314 9/20/2006 12:00 myserver1 REGREP R: 921.6 MB 913.97 MB 99.17
1315 9/20/2006 12:00 myserver1 SMTP T: 15.36 GB 12.96 GB 84.36
And have the query results returned like this:
myserver1
9/10/2006 08:00 9/10/2006 20:00 9/11/2006 08:00
DriveLetter VolumeName TotalSize FreeSpace Percent FreeSpace Percent FreeSpace Percent
C: Local Disk 15.50 10.99 70.90 10.98 70.84 10.98 70.84
E: Local Disk 5.86 3.83 65.36 3.83 65.36 3.83 65.36
F: Page File 12.40 10.68 86.13 10.68 86.13 10.68 86.13
I: 1st SG Trns Logs 50.00 49.55 99.10 49.41 98.82 49.14 98.28
J: 2nd SG Trns Logs 50.00 49.54 99.08 49.49 98.98 49.42 98.84
K: 3rd SG Trns Logs 50.00 49.73 99.46 49.67 99.34 68.94 137.88
L: 1st SG DBs Logs 130.00 75.63 58.18 69.11 53.16 75.26 57.89
M: 2nd SG DBs Logs 130.00 78.76 60.58 75.27 57.90 71.54 55.03
N: 3r SG DBs Logs 130.00 77.66 59.74 71.58 55.06 71.47 54.98
T: SMTP Queue 50.00 49.75 99.50 49.74 99.48 49.72 99.44
Z: Double Take 65.00 63.44 97.60 63.44 97.60 63.44 97.60
I was thinking of using arrays and pull the result out of that. Which I know I can do, but I think this could be done with some combination of SQL statements. This is with MSSQL2000.
Thanks!
Start Free Trial