dbo.obtener_batch_afip_fisicas

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@nivelador bit 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.obtener_batch_afip_fisicas
@nivelador bit
AS
BEGIN

 if(@nivelador = 0)
 begin
  select top 2500 identificacion from padrones 
  where identificacion  between '20260000000'  and  '20430000009' and ismodified is null and habilitado = 1 

  union
  select top 2500 identificacion from padrones 
  where identificacion  between '23260000000'  and  '23430000009' and ismodified is null and habilitado = 1 

  union
   select top 2500 identificacion from padrones 
  where identificacion  between '24260000000'  and  '24430000009' and ismodified is null and habilitado = 1 

  union
  select top 2500 identificacion from padrones 
  where identificacion  between '27260000000'  and  '27430000009' and ismodified is null and habilitado = 1 
  order by identificacion asc
 end
else
 begin
  select top 2500 identificacion from padrones 
  where identificacion  between '20000000000'  and  '20260000009' and ismodified is null and habilitado = 1 

  union
  select top 2500 identificacion from padrones 
  where identificacion  between '23000000000'  and  '23260000009' and ismodified is null and habilitado = 1 

  union
   select top 2500 identificacion from padrones 
  where identificacion  between '24000000000'  and  '24260000009' and ismodified is null and habilitado = 1 

  union
  select top 2500 identificacion from padrones 
  where identificacion  between '27000000000'  and  '27260000009' and ismodified is null and habilitado = 1 
  order by identificacion desc

 end

END
GO

Depends On

1

Used By

No items found