dbo.backend_obtener_fuentes_procesadas

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

3
Name Data Type Length Description
@p_fuente varchar 20
@p_fecha_desde varchar 10
@p_fecha_hasta varchar 10

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.backend_obtener_fuentes_procesadas
@p_fuente varchar(20) = null,
@p_fecha_desde varchar(10) = null, 
@p_fecha_hasta varchar(10) = null
AS


BEGIN
    SET NOCOUNT ON;
 /*
  select fp.fuente,fp.fecha_informacion,fp.created,observaciones from fuentes_procesadas fp
   --where visible = 1
  order by fuente,created
  */

 
 declare @fecha_desde date
 declare @fecha_hasta date
 
 if (@p_fecha_desde is null or @p_fecha_desde = '') 
   begin 
     set @fecha_desde = '2001-01-01' 
      end 
   else
   begin
     set @fecha_desde  = convert(date, @p_fecha_desde)
   end 
 if (@p_fecha_hasta is null or @p_fecha_hasta = '') 
   begin 
     set @fecha_hasta = convert(date, getdate()) 
   end 
    else
   begin
     set @fecha_hasta  = convert(date, @p_fecha_hasta)
   end 

 if (@p_fuente = '')
 begin
  set @p_fuente = null
 end 

 if (@p_fuente is null) 
   begin
  select fp.fuente,fp.fecha_informacion,fp.created,observaciones from fuentes_procesadas fp
   where convert(date,created) between @fecha_desde and @fecha_hasta
  order by fuente,created
    end
 else 
   begin
  select fp.fuente,fp.fecha_informacion,fp.created,observaciones from fuentes_procesadas fp
  where fuente = @p_fuente
    and convert(date,created) between @fecha_desde and @fecha_hasta
  order by fuente,created
   end

END

GO

Depends On

1

Used By

No items found