68 lines
1.4 KiB
Transact-SQL
68 lines
1.4 KiB
Transact-SQL
USE [HCITools]
|
|
GO
|
|
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mon_Purge_All_Stats_SP]') AND type in (N'P', N'PC'))
|
|
DROP PROCEDURE [dbo].[mon_Purge_All_Stats_SP]
|
|
GO
|
|
|
|
USE [HCITools]
|
|
GO
|
|
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[mon_Purge_All_Stats_SP]
|
|
@in_debug tinyint = null
|
|
AS
|
|
/*=============================================================================
|
|
|
|
Explication du traitement realise par la SP
|
|
-------------------------------------------
|
|
Cette SP sert à supprimer les données des statistiques des procédure stockées de plus de 12 mois
|
|
|
|
Contexte d'utilisation
|
|
----------------------
|
|
Cette SP est appelée par le job D93140 - Purge All Stats SP
|
|
|
|
Parametres
|
|
----------
|
|
@in_debug : non utilisé
|
|
|
|
|
|
Creation : 23.09.20 / FLA
|
|
|
|
Modifications :
|
|
|
|
|
|
|
|
=============================================================================*/
|
|
|
|
set nocount on;
|
|
|
|
/*-------------------------- Traitement ---------------------------*/
|
|
BEGIN TRY
|
|
|
|
/* suppression de l'historique des SP plus vieux de 12 mois */
|
|
DELETE [HCITools].[dbo].[All_Stats_SP]
|
|
WHERE SS_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
|
|
|
|
|