Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @fecha | date | 3 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: Maria Ines Soria
-- Create date: 23/11/2017
-- Description: Proceso de Insur
-- =============================================
-- [procesamiento_insur_salida] '2017-11-21'
CREATE OR ALTER PROCEDURE dbo.procesamiento_insur_salida
@fecha date = null
as
BEGIN
/*
El arhivo debe tener:
Posicion 1 a 11 CUIT -> 11
Posicion 12 a 189 NOMBRE -> 178
Posicion 190 al 396 DETALLE -> 207
*/
if (@fecha is null)
begin
set @fecha = CAST(GETDATE() AS date)
--set @fecha = '2017-11-21'
end
SET NOCOUNT ON;
if (select hora_fin from insur_totales
where fecha = @fecha) is not null -- se fija que haya terminado el proceso para generar la salida.
begin
select distinct right('00000000000' + RTRIM(ltrim(cuit)), 11) as cuit,
left(isnull(rtrim(nombre),'')+' ',178) as nombre,
left(isnull(rtrim(detalle),'')+' ',207) as detalle
from insur_procesamiento
order by cuit asc
end
END
GO
GO
-- =============================================
-- Author: Maria Ines Soria
-- Create date: 23/11/2017
-- Description: Proceso de Insur
-- =============================================
-- [procesamiento_insur_salida] '2017-11-21'
CREATE OR ALTER PROCEDURE dbo.procesamiento_insur_salida
@fecha date = null
as
BEGIN
/*
El arhivo debe tener:
Posicion 1 a 11 CUIT -> 11
Posicion 12 a 189 NOMBRE -> 178
Posicion 190 al 396 DETALLE -> 207
*/
if (@fecha is null)
begin
set @fecha = CAST(GETDATE() AS date)
--set @fecha = '2017-11-21'
end
SET NOCOUNT ON;
if (select hora_fin from insur_totales
where fecha = @fecha) is not null -- se fija que haya terminado el proceso para generar la salida.
begin
select distinct right('00000000000' + RTRIM(ltrim(cuit)), 11) as cuit,
left(isnull(rtrim(nombre),'')+' ',178) as nombre,
left(isnull(rtrim(detalle),'')+' ',207) as detalle
from insur_procesamiento
order by cuit asc
end
END
GO
Depends On
2Used By
No items found