Skip to content

Instantly share code, notes, and snippets.

@revirth
Created September 23, 2014 01:55
Show Gist options
  • Save revirth/b46799075a5253ba6538 to your computer and use it in GitHub Desktop.
Save revirth/b46799075a5253ba6538 to your computer and use it in GitHub Desktop.
use master;
-- database_connection_stats daily, hourly
select database_name, cast(end_time as varchar(13)) end_date,
SUM(success_count) success_count, SUM(total_failure_count) total_failure_count, SUM(connection_failure_count) connection_failure_count,
SUM(terminated_connection_count) terminated_connection_count, SUM(throttled_connection_count) throttled_connection_count
from sys.database_connection_stats
where database_name = 'DB Name'
group by database_name, cast(end_time as varchar(13))
having SUM(total_failure_count) > 10
order by end_date desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment