113 lines
3.9 KiB
Transact-SQL
113 lines
3.9 KiB
Transact-SQL
-- Schema: C6MartPeriodico
|
|
-- Stored Procedure: SRV_SELEZIONA_CAMPIONE
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE procedure [C6MartPeriodico].[SRV_SELEZIONA_CAMPIONE]
|
|
|
|
AS
|
|
BEGIN
|
|
--procedura di caricamento campione
|
|
|
|
DECLARE @appoDataInizioTrimestre varchar(8)
|
|
|
|
SET @appoDataInizioTrimestre = [C6MartPeriodico].[getDateTrimestre](0, 0, 0)
|
|
|
|
--SET @appoDataInizioTrimestre = '20190101'
|
|
|
|
--SET @appoDataInizioTrimestre = '20181001'
|
|
--SET @appoDataInizioTrimestre = '20180701'
|
|
--SET @appoDataInizioTrimestre = '20180401'
|
|
--SET @appoDataInizioTrimestre = '20180101'
|
|
--SET @appoDataInizioTrimestre = '20171001'
|
|
--SET @appoDataInizioTrimestre = '20170701'
|
|
--SET @appoDataInizioTrimestre = '20170401'
|
|
--SET @appoDataInizioTrimestre = '20170101'
|
|
--SET @appoDataInizioTrimestre = '20161001'
|
|
--SET @appoDataInizioTrimestre = '20160701'
|
|
--SET @appoDataInizioTrimestre = '20160401'
|
|
--SET @appoDataInizioTrimestre = '20160101'
|
|
--SET @appoDataInizioTrimestre = '20151001'
|
|
--SET @appoDataInizioTrimestre = '20150701'
|
|
|
|
DECLARE @appoDataFineTrimestre varchar(8)
|
|
|
|
SET @appoDataFineTrimestre = [C6MartPeriodico].[getDateTrimestre](0, 1, 0)
|
|
|
|
--SET @appoDataFineTrimestre = '20181231'
|
|
|
|
--SET @appoDataFineTrimestre = '20180930'
|
|
--SET @appoDataFineTrimestre = '20180630'
|
|
--SET @appoDataFineTrimestre = '20180331'
|
|
--SET @appoDataFineTrimestre = '20171231'
|
|
--SET @appoDataFineTrimestre = '20170930'
|
|
--SET @appoDataFineTrimestre = '20170630'
|
|
--SET @appoDataFineTrimestre = '20170331'
|
|
--SET @appoDataFineTrimestre = '20161231'
|
|
--SET @appoDataFineTrimestre = '20160930'
|
|
--SET @appoDataFineTrimestre = '20160630'
|
|
--SET @appoDataFineTrimestre = '20160331'
|
|
--SET @appoDataFineTrimestre = '20151231'
|
|
--SET @appoDataFineTrimestre = '20150930'
|
|
|
|
DECLARE @appoDataInizioTrimPrec varchar(8)
|
|
|
|
SET @appoDataInizioTrimPrec = [C6MartPeriodico].[getDateTrimestre](1, 0, 0)
|
|
|
|
--SET @appoDataInizioTrimPrec = '20181001'
|
|
|
|
--SET @appoDataInizioTrimPrec = '20180701'
|
|
--SET @appoDataInizioTrimPrec = '20180401'
|
|
--SET @appoDataInizioTrimPrec = '20180101'
|
|
--SET @appoDataInizioTrimPrec = '20171001'
|
|
--SET @appoDataInizioTrimPrec = '20170701'
|
|
--SET @appoDataInizioTrimPrec = '20170401'
|
|
--SET @appoDataInizioTrimPrec = '20170101'
|
|
--SET @appoDataInizioTrimPrec = '20161001'
|
|
--SET @appoDataInizioTrimPrec = '20160701'
|
|
--SET @appoDataInizioTrimPrec = '20160401'
|
|
--SET @appoDataInizioTrimPrec = '20160101'
|
|
--SET @appoDataInizioTrimPrec = '20151001'
|
|
--SET @appoDataInizioTrimPrec = '20150701'
|
|
--SET @appoDataInizioTrimPrec = '20150401'
|
|
|
|
DECLARE @appoDataFineTrimPrec varchar(8)
|
|
|
|
SET @appoDataFineTrimPrec = [C6MartPeriodico].[getDateTrimestre](1, 1, 0)
|
|
|
|
--SET @appoDataFineTrimPrec = '20180930'
|
|
|
|
--SET @appoDataFineTrimPrec = '20180630'
|
|
--SET @appoDataFineTrimPrec = '20180331'
|
|
--SET @appoDataFineTrimPrec = '20171231'
|
|
--SET @appoDataFineTrimPrec = '20170930'
|
|
--SET @appoDataFineTrimPrec = '20170630'
|
|
--SET @appoDataFineTrimPrec = '20170331'
|
|
--SET @appoDataFineTrimPrec = '20161231'
|
|
--SET @appoDataFineTrimPrec = '20160930'
|
|
--SET @appoDataFineTrimPrec = '20160630'
|
|
--SET @appoDataFineTrimPrec = '20160331'
|
|
--SET @appoDataFineTrimPrec = '20151231'
|
|
--SET @appoDataFineTrimPrec = '20150930'
|
|
--SET @appoDataFineTrimPrec = '20150630'
|
|
|
|
-- QUI VA SPECIFICATO IL PERIODO DI EFFETTIVA GENERAZIONE DEI REPORT CHE, IN GENERE, E' IL MESE SUCCESSIVO
|
|
-- A QUELLO DI FINE TRIMESTRE
|
|
DECLARE @appoDataGenerazioneTrimPrecDa varchar(8)
|
|
|
|
SET @appoDataGenerazioneTrimPrecDa = [C6MartPeriodico].[getDateTrimestre](1, 0, 0)
|
|
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20181001'
|
|
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20180701'
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20180401'
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20180101'
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20171001'
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20170701'
|
|
--SET @appoDataGenerazioneTrimPrecDa = '20170401'
|
|
--SET @appoDataGe
|