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 | |
| @tipo | varchar | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- [verificar_padron] '20132970883','DNI'
CREATE OR ALTER PROCEDURE dbo.verificar_padron
@numero varchar(13),
@tipo varchar(4)
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
/* insertar consulta */
BEGIN
if(@tipo = 'DNI')
begin
declare @numero2 char(13) = @numero
if (len(@numero) < 8) set @numero2 = RIGHT('00000000'+@numero,8)
select * from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
order by identificacion
end
else
begin
select * from padrones where identificacion = @numero and habilitado = 1
end
END
END TRY
BEGIN CATCH
--SELECT @out_error_number=ERROR_NUMBER()
END CATCH
END
GO
GO
-- [verificar_padron] '20132970883','DNI'
CREATE OR ALTER PROCEDURE dbo.verificar_padron
@numero varchar(13),
@tipo varchar(4)
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
/* insertar consulta */
BEGIN
if(@tipo = 'DNI')
begin
declare @numero2 char(13) = @numero
if (len(@numero) < 8) set @numero2 = RIGHT('00000000'+@numero,8)
select * from padrones
where (cuerpo_clave = @numero or
cuerpo_clave = @numero2)
and identificacion like '2%'
and habilitado = 1
order by identificacion
end
else
begin
select * from padrones where identificacion = @numero and habilitado = 1
end
END
END TRY
BEGIN CATCH
--SELECT @out_error_number=ERROR_NUMBER()
END CATCH
END
GO
Depends On
1Used By
No items found