I have a table called 'Disk_Info' that basically looks like this:
SystemName DeviceID Size . . . . . . (other irrelevant columns)
System1 C 12888980992
System1 D 64428552192
System1 E 6432133120
System2 C 5354622976
System2 L 15035777024
System3 C 27924791296
I need to output it via a sql query into the following format:
SystemName DISK0 DISK1 DISK2 DISK3 DISK4 DISK(n)...
System1 C: 14gb D: 20gb
System2 C: 14gb D: 20gb E: 14gb P: 20gb
System3 C: 14gb D: 20gb E: 14gb P: 20gb L: 100gb
System4 C: 14gb
. . . . . .
. . .
So the source table Disk Size is in bytes but for gigabytes it just needs to be divided like: Size/1024/1024/1024 = GB and rounded to the nearest whole number.
The number of 'Disks' per system also vary, however I don't need anymore disk info beyond disk 9 so Disk0 - Disk8 would suffice.
This only needs to work on MS SQL Server 2008 and doesn't need to be backwards compatible.
Thanks in advance!