dbo.trazabilidad_configuracion

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

6
Name Data Type Length Description
@accion varchar 50
@plataforma varchar 20
@id_set_doc int 4
@id_tipo_doc int 4
@id_tipo_informe int 4
@id_componente int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*


exec trazabilidad_configuracion 'TRAZABILIDAD_BY_SETDOC',10,104
exec trazabilidad_configuracion 'TRAZABILIDAD_BY_TIPODOC',10,104
EXEC trazabilidad_configuracion 'TRAZABILIDAD_BY_SETDOC','PRODBACK','218',null,null



*/



CREATE OR ALTER PROCEDUREdbo.trazabilidad_configuracion
    @accion VARCHAR(50),
    @plataforma VARCHAR(20),
    @id_set_doc int = null,
    @id_tipo_doc int = null,
    @id_tipo_informe int = null,
    @id_componente int = null


AS
BEGIN
    SET NOCOUNT ON;
    IF ( @accion = 'TRAZABILIDAD_BY_SETDOC' )
        -- Devuelve los trazabilidad por id de setdoc
        BEGIN
            SELECT top 50 trazabilidad.*, 
   iif(isnull(users.first_name,'')!= '' or isnull(users.last_name,'')!= '',
       isnull(users.first_name,'') + ' ' + isnull(users.last_name,''),
    isnull(users.username,'')) as nombre_persona
   FROM trazabilidad
   left join users on users.user_id = trazabilidad.user_id
            WHERE id_plataforma=@plataforma and set_doc = @id_set_doc ORDER BY created DESC;
            RETURN;
        END
    IF ( @accion = 'TRAZABILIDAD_BY_TIPODOC' )
        -- Devuelve los trazabilidad por id de tipodoc
        BEGIN
            SELECT top 50 trazabilidad.*, 
   iif(isnull(users.first_name,'')!= '' or isnull(users.last_name,'')!= '',
       isnull(users.first_name,'') + ' ' + isnull(users.last_name,''),
    isnull(users.username,'')) as nombre_persona
   FROM trazabilidad
   left join users on users.user_id = trazabilidad.user_id
            WHERE id_plataforma=@plataforma and tipo_doc = @id_tipo_doc ORDER BY created DESC;
            RETURN;
        END
    IF ( @accion = 'TRAZABILIDAD_BY_TIPOINFORME' )
        -- Devuelve los trazabilidad por id de tipoinforme
        BEGIN
            SELECT top 50 trazabilidad.*, 
   iif(isnull(users.first_name,'')!= '' or isnull(users.last_name,'')!= '',
       isnull(users.first_name,'') + ' ' + isnull(users.last_name,''),
    isnull(users.username,'')) as nombre_persona
   FROM trazabilidad
   left join users on users.user_id = trazabilidad.user_id
            WHERE id_plataforma=@plataforma and idTipoInforme = @id_tipo_informe ORDER BY created DESC;
            RETURN;
        END
    IF ( @accion = 'TRAZABILIDAD_BY_COMPONENTE' )
        -- Devuelve los trazabilidad por id de tipoinforme
        BEGIN
            SELECT top 50 trazabilidad.*, 
   iif(isnull(users.first_name,'')!= '' or isnull(users.last_name,'')!= '',
       isnull(users.first_name,'') + ' ' + isnull(users.last_name,''),
    isnull(users.username,'')) as nombre_persona
   FROM trazabilidad
   left join users on users.user_id = trazabilidad.user_id
            WHERE id_plataforma=@plataforma and idComponente = @id_componente ORDER BY created DESC;
            RETURN;
        END


END 
GO

Used By

No items found