Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @numero | varchar | 13 | |
| @sexo | varchar | 1 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- [verificar_padron_dni_sexo] '16875774','M'
-- [verificar_padron_dni_sexo] '59144','M'
-- [verificar_padron_dni_sexo] '59144','F'
CREATE OR ALTER PROCEDURE dbo.verificar_padron_dni_sexo
@numero varchar(13),
@sexo varchar(1)
AS
BEGIN
SET NOCOUNT ON;
BEGIN
declare @numero2 char(13) = @numero
if (len(@numero) < 8) set @numero2 = RIGHT('00000000'+@numero,8)
if (select COUNT(*)
from padrones
where (cuerpo_clave = @numero or cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and (sexo = @sexo)) = 0
select top 1 identificacion, nombre_persona,
IIF (nombres is null and apellidos is null, nombre_persona, apellidos) as apellidos,
nombres
from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and sexo is null
order by identificacion
else
select top 1 identificacion, nombre_persona,
IIF (nombres is null and apellidos is null, nombre_persona, apellidos) as apellidos,
nombres
from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and (sexo = @sexo)
order by identificacion
END
END
GO
GO
-- [verificar_padron_dni_sexo] '16875774','M'
-- [verificar_padron_dni_sexo] '59144','M'
-- [verificar_padron_dni_sexo] '59144','F'
CREATE OR ALTER PROCEDURE dbo.verificar_padron_dni_sexo
@numero varchar(13),
@sexo varchar(1)
AS
BEGIN
SET NOCOUNT ON;
BEGIN
declare @numero2 char(13) = @numero
if (len(@numero) < 8) set @numero2 = RIGHT('00000000'+@numero,8)
if (select COUNT(*)
from padrones
where (cuerpo_clave = @numero or cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and (sexo = @sexo)) = 0
select top 1 identificacion, nombre_persona,
IIF (nombres is null and apellidos is null, nombre_persona, apellidos) as apellidos,
nombres
from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and sexo is null
order by identificacion
else
select top 1 identificacion, nombre_persona,
IIF (nombres is null and apellidos is null, nombre_persona, apellidos) as apellidos,
nombres
from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
and (sexo = @sexo)
order by identificacion
END
END
GO
Depends On
1Used By
No items found