dbo.obtener_telefonos_todos

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@cuit varchar 20
@id int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Maria Ines Soria>
-- Create date: <30 Abr 2019>
-- Description: <Obtener todos los telĂ©fonos de un Cuit>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.obtener_telefonos_todos
 -- Add the parameters for the stored procedure here
 @cuit varchar(20),
 @id int 

AS
BEGIN
 SET NOCOUNT ON;

 if (@id != 0)
 begin
   select telefono, tipo, id_telefono from telefonos where id_telefono = @id
 end 

 else

 begin
  declare @id_padron int
  if (select count(*) from padrones where identificacion = @cuit and habilitado = 1) = 1 
  begin
    set @id_padron = (select id_padron from padrones where identificacion = @cuit and habilitado = 1)
    select telefono, tipo, id_telefono from telefonos where (id_padron = @id_padron) --and  (tipo != 'MOVIL' or tipo is null)
  end 
 end 


END

GO

Used By

No items found