IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[_asb_atributosOtCall]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[_asb_atributosOtCall]

go


CREATE PROCEDURE [dbo].[_asb_atributosOtCall] 
@p_idEquipo int

AS
BEGIN

Select
ATR.id_atributo as idAtributo
,ATR.id_subtipoDocumento idSubtipoDoc
,dbo.f_opcionesAtributo(ATR.id_atributo,2) as opcionesCod 
,dbo.f_opcionesAtributo(ATR.id_atributo,0) as opcionesTexto
,ATR.doc_subtipoDocumento_subtipoDocumento_codigo as subtipoDoc_codigo
,ATR.cat_atributo_atributo atributo,cat_atributo_atributo_codigo as atributoCod
,ATR.cat_atributo_id_tipoAtributo as idTipoAtributo
,ATR.cat_atributo_esObligatorio as esObligatorio
,ATR.orden as orden
from
view_doc_subtipoDocumento_atributo ATR
where
ATR.id_subtipoDocumento=2


END
