-- Stored Procedure: dbo.GetSPTMonitorHistory -- Bill Wunder use admin GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSPTMonitorHistory]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[GetSPTMonitorHistory] GO create procedure dbo.GetSPTMonitorHistory as /******************************************************************************************************* * admin.dbo.GetSPTMonitorHistory * Creator: Bill Wunder * * Outline: Sample the current System Statistical Functions values into a tracking table * * usage: EXECUTE admin.dbo.GetSPTMonitorHistory * Notes: * * Modifications * name date brief description * ------- ---------- ------------------------------------------------------------ * ********************************************************************************************************/ -- declare variables -- set session set nocount on -- create temp tables -- body of stored procedure if object_id('admin.dbo.SPTMonitorHistory','U') is null create table admin.dbo.SPTMonitorHistory ( id int identity(1,1) , lastrun datetime not null , cpu_busy bigint not null , io_busy bigint not null , idle bigint not null , pack_received bigint not null , pack_sent bigint not null , connections bigint not null , pack_errors bigint not null , total_read bigint not null , total_write bigint not null , total_errors bigint not null constraint pkc_SPTMonitorHistory__id primary key (id)) insert admin.dbo.SPTMonitorHistory ( lastrun , cpu_busy , io_busy , idle , pack_received , pack_sent , connections , pack_errors , total_read , total_write , total_errors) values ( getdate() , @@cpu_busy , @@io_busy , @@idle , @@pack_received , @@pack_sent , @@connections , @@packet_errors , @@total_read , @@total_write , @@total_errors) GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO