Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How can I get column totals with group breaks

$
0
0

We manually generate a report of file groups and their associated data files each day for each of our databases.

For each database we take data from dbcc showfilestats and assemble it into an Excel spreadsheet (see below).

I would like to use a SQL job to generate the reports (results do not need to be in Excel format). I can insert the data from the DBCC into a table; but, I'm stuck on how to write a select statement that will break on file group and provide column totals. I've been looking at group by; but, I don't see how to make it work.

Suggestions?

FileGroupFileIDVolumeAllocated(MB)Used space(MB) Free space(MB)Used %
11Data1100505050%
115Data220017512587.50%
121Data33002001006.60%
            60042527570.80%
FileGroupFileIDVolumeAllocated(MB)Used space(MB) Free space(MB)Used %
21index1100505050%
215index220017512587.50%
221index33002001006.60%
60042527570.80%


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>