A catagory chart example

The specification for this chart

<result>
	<result-type>GRAPHICAL</result-type>
	<sql>
		SELECT top 10
		case when len(DB.name) &gt; 30 then substring(DB.name,1,30)+'_DBID_'
			+cast(DB.database_id as varchar(4)) +' (alias)' else DB.name end AS 
			"Database name",
		(SELECT SUM((size*8)/1024) FROM sys.sysaltfiles WHERE DB_NAME(dbid) = 
			DB.name AND groupid!=0)+
		(SELECT SUM((size*8)/1024) FROM sys.sysaltfiles WHERE DB_NAME(dbid) = 
			DB.name AND groupid=0) "Total size",
		(SELECT SUM((size*8)/1024) FROM sys.sysaltfiles WHERE DB_NAME(dbid) = 
			DB.name AND groupid!=0) AS "Data file(s) size",
		(SELECT SUM((size*8)/1024) FROM sys.sysaltfiles WHERE DB_NAME(dbid) = 
			DB.name AND groupid=0) AS "Transaction log(s) size",
		(SELECT COUNT(1) FROM sys.sysaltfiles WHERE DB_NAME(dbid) = DB.name ) 
			AS "Total file/log count"
		FROM sys.databases DB where DB.name not in (N'master',N'model',N'msdb',N'tempdb')
		order by 2 desc
	</sql>
	<graphical>
		<title>Top 10 Database size (MB)</title>
		<resultset>
			<column>
				<name>Database name</name>
				<sql-type>0</sql-type>
				<label></label>
			</column>
			<column>
				<name>Total size</name>
				<sql-type>1</sql-type>
				<label>MB</label>
			</column>
			<column>
				<name>Data file(s) size</name>
				<sql-type>1</sql-type>
				<label>MB</label>
			</column>
			<column>
				<name>Transaction log(s) size</name>
				<sql-type>2</sql-type>
				<label>MB</label>
			</column>
			<column>
				<name>Total file/log count</name>
				<sql-type>6</sql-type>
				<label></label>
			</column>
		</resultset>
		<category-chart>
			<categories>Database name</categories>
			<chart-type>5</chart-type>
			<to-plot>Data file(s) size</to-plot>
			<to-plot>Transaction log(s) size</to-plot>
		</category-chart>
	</graphical>
</result>

← Pie chart / Category line chart →

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment