dbo.Imperium_Status_Documentos_Periodo_Vencido_Anterior

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Imperium_Status_Documentos_Periodo_Vencido_Anterior
 -- Add the parameters for the stored procedure here
 
 /***
 
  para ejecutar al inicio de cada nuevo perĂ­odo.
 
  Por ejemplo en 01/05 reprocesa todos los documentos pendientes para pasarlos a vencidos del perĂ­odo 03.
 
  ***/

 
AS
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for procedure here
 declare @d bigint
 
 declare TTT cursor for
 
 select doc_id from led_docs 
 where doc_id_lista is null 
 and estado_doc='N' 
 and status_doc = 'N' 
 and periodo=dbo.PeriodoMenosDos() 
 
 open TTT
 fetch next from TTT into @d
 while @@FETCH_STATUS=0 begin
  exec Imperium_Status_Doc @d
  fetch next from TTT into @d
 end
 close TTT
 deallocate TTT
 
END

GO