sync
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
USE [HCITools]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mon_Purge_Stats_Index]') AND type in (N'P', N'PC'))
|
||||
DROP PROCEDURE [dbo].[mon_Purge_Stats_Index]
|
||||
GO
|
||||
|
||||
USE [HCITools]
|
||||
GO
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
|
||||
CREATE PROCEDURE [dbo].[mon_Purge_Stats_Index]
|
||||
@in_debug tinyint = 0
|
||||
AS
|
||||
/*=============================================================================
|
||||
|
||||
Explication du traitement realise par la SP
|
||||
-------------------------------------------
|
||||
La SP va purger l'ensemble des traces contenues dans la table HCITools.dbo.Stats_index datant d'avant le redémarrage du serveur
|
||||
|
||||
Contexte d'utilisation
|
||||
----------------------
|
||||
Appelé depuis le job D9207X - Transfert Stats Index
|
||||
|
||||
Parametres
|
||||
----------
|
||||
@in_debug : non utilisé
|
||||
|
||||
Creation : 27.10.16 / FLA
|
||||
|
||||
Modifications : 28.10.2016 / FLA : Standardisation de la gestion des erreurs
|
||||
24.09.2018 / FLA : Remove references to undocumented system tables
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
set nocount on;
|
||||
|
||||
|
||||
/*------------------- Declaration des variables --------------------*/
|
||||
|
||||
declare @restartdate datetime,
|
||||
@errno int,
|
||||
@errmsg varchar(255)
|
||||
|
||||
/*------------ Affectation des parametres aux variables ------------*/
|
||||
|
||||
select @RestartDate = MIN(login_time) from sys.dm_exec_sessions
|
||||
|
||||
/*-------------------------- Traitement ---------------------------*/
|
||||
BEGIN TRY
|
||||
DELETE si FROM [HCITools].[dbo].[Stats_index] si
|
||||
WHERE SI_updatedate < CAST(CONVERT(nvarchar(30),@RestartDate,126) as datetime)
|
||||
|
||||
/*---------------------- Traitement des erreurs ----------------------*/
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
|
||||
/* Traitement des erreurs (avec RaiseError) */
|
||||
EXEC dbo.get_Error_Info @in_RaiseError = 1
|
||||
|
||||
END CATCH
|
||||
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user