DPA Metric query collector report Day tables.

This query is to gather metrics from the DPA repository for reporting. There is a long time feature request to report on DPA's metrics in the product but, for now the data can be mined from the repository database. 

Notes on Structure. DPA stores the metrics in  table sets for detail data and summary data. Detail data tables are names such as CON_METRICS_DETAIL_X where X is the ID of a registered instance in DPA in the table COND. Instance with ID of 1 would be CON_METRICS_DETAIL_1 etc. Summary tables are names like CON_METRICS_TEN_MINUTE_X, CON_METRIC_HOUR_X, CON_METRIC_DAY_X and contain the V_MIN, V_MAX, V_SUM, V_AVG. 

For more on table structure see the following KB https://support.solarwinds.com/SuccessCenter/s/article/DPA-Database-Metrics-Architecture?language=en_US

of Value min, max, sum and average for each of the metrics for the role up time of the tables respectively. 

The file posted here is TSQL that is to collect metrics from the detail table in a loop of the metric names given as uncommented inserts at top. For all instances in DPA that are SQL server as the list is all SQL server metric names and for a provided date range.