68 lines
1.5 KiB
Transact-SQL
68 lines
1.5 KiB
Transact-SQL
USE [HCITools]
|
|
GO
|
|
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mon_Purge_All_Stats_Index]') AND type in (N'P', N'PC'))
|
|
DROP PROCEDURE [dbo].[mon_Purge_All_Stats_Index]
|
|
GO
|
|
|
|
USE [HCITools]
|
|
GO
|
|
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[mon_Purge_All_Stats_Index]
|
|
@in_debug tinyint = null
|
|
AS
|
|
/*=============================================================================
|
|
|
|
Explication du traitement realise par la SP
|
|
-------------------------------------------
|
|
Cette SP sert à supprimer les données des statistiques des indexes de plus de 12 mois
|
|
|
|
Contexte d'utilisation
|
|
----------------------
|
|
Cette SP est appelée par le job D93150 - Purge All Stats Index
|
|
|
|
Parametres
|
|
----------
|
|
@in_debug : non utilisé
|
|
|
|
|
|
Creation : 04.10.18 / SPE
|
|
|
|
Modifications :
|
|
|
|
26.02.2019 - SPE - #TFS51645# Reduce history retention on table [HCITools].[dbo].[All_Stats_index]
|
|
|
|
=============================================================================*/
|
|
|
|
set nocount on;
|
|
|
|
/*-------------------------- Traitement ---------------------------*/
|
|
BEGIN TRY
|
|
|
|
/* suppression de l'historique des indexes plus vieux de 12 mois */
|
|
DELETE [HCITools].[dbo].[All_Stats_index]
|
|
WHERE SI_updatedate <= dateadd(month, -12, getdate())
|
|
|
|
|
|
/*---------------------- Traitement des erreurs ----------------------*/
|
|
END TRY
|
|
BEGIN CATCH
|
|
|
|
/* Traitement des erreurs (avec RaiseError) */
|
|
EXEC dbo.get_Error_Info @in_RaiseError = 1
|
|
|
|
END CATCH
|
|
|
|
|
|
|
|
GO
|
|
|
|
|