Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @dni | varchar | 20 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.servicio_validacion_empleo
@dni varchar(20)
AS
BEGIN
SET NOCOUNT ON;
declare @identificacion varchar(20),@nombre_y_apellido varchar(200),@relacion_dependencia int
if((select count(*) from padrones where padrones.cuerpo_clave = @dni and habilitado = 1) = 1)
begin
set @identificacion = (select distinct identificacion from padrones where padrones.cuerpo_clave = @dni and habilitado = 1)
set @nombre_y_apellido = (select distinct nombre_persona from padrones where padrones.cuerpo_clave = @dni and habilitado = 1)
set @relacion_dependencia = (select top 1 count(*) from empleados where cuil = @identificacion and periodo >= (
select convert(varchar,Right(Year(getDate()-120),2)) + convert(varchar,Right(month(getDate()-120),2)) ) )
if(@relacion_dependencia = 0)
begin
set @relacion_dependencia = (select top 1 count(*) from empleados_temp where cuil = @identificacion and periodo >= (
select convert(varchar,Right(Year(getDate()-120),2)) + convert(varchar,Right(month(getDate()-120),2)) ) )
end
select @identificacion as identificacion,@relacion_dependencia as relacion_dependencia,@nombre_y_apellido as nombre_y_apellido, 'ok' as respuesta
end
else if((select count(*) from padrones where padrones.cuerpo_clave = @dni and habilitado = 1) = 0)
begin
select distinct @dni as identificacion,0 as relacion_dependencia,'' as nombre_y_apellido,'error' as respuesta
end
else
begin
select distinct identificacion,iif(empleados.cuil is null,0,1) as relacion_dependencia,nombre_persona as nombre_y_apellido,'2' as respuesta from padrones left join
empleados on empleados.cuil = identificacion
where padrones.habilitado = 1 and cuerpo_clave =@dni
end
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.servicio_validacion_empleo
@dni varchar(20)
AS
BEGIN
SET NOCOUNT ON;
declare @identificacion varchar(20),@nombre_y_apellido varchar(200),@relacion_dependencia int
if((select count(*) from padrones where padrones.cuerpo_clave = @dni and habilitado = 1) = 1)
begin
set @identificacion = (select distinct identificacion from padrones where padrones.cuerpo_clave = @dni and habilitado = 1)
set @nombre_y_apellido = (select distinct nombre_persona from padrones where padrones.cuerpo_clave = @dni and habilitado = 1)
set @relacion_dependencia = (select top 1 count(*) from empleados where cuil = @identificacion and periodo >= (
select convert(varchar,Right(Year(getDate()-120),2)) + convert(varchar,Right(month(getDate()-120),2)) ) )
if(@relacion_dependencia = 0)
begin
set @relacion_dependencia = (select top 1 count(*) from empleados_temp where cuil = @identificacion and periodo >= (
select convert(varchar,Right(Year(getDate()-120),2)) + convert(varchar,Right(month(getDate()-120),2)) ) )
end
select @identificacion as identificacion,@relacion_dependencia as relacion_dependencia,@nombre_y_apellido as nombre_y_apellido, 'ok' as respuesta
end
else if((select count(*) from padrones where padrones.cuerpo_clave = @dni and habilitado = 1) = 0)
begin
select distinct @dni as identificacion,0 as relacion_dependencia,'' as nombre_y_apellido,'error' as respuesta
end
else
begin
select distinct identificacion,iif(empleados.cuil is null,0,1) as relacion_dependencia,nombre_persona as nombre_y_apellido,'2' as respuesta from padrones left join
empleados on empleados.cuil = identificacion
where padrones.habilitado = 1 and cuerpo_clave =@dni
end
END
GO
Depends On
2Used By
No items found