Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_contraparte | int | 4 | |
| @p_gestion | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- Create the stored procedure in the specified schema
CREATE OR ALTER PROCEDURE dbo.Revertir_DocsOK_Gestion
@p_contraparte int,
@p_gestion int
-- add more stored procedure parameters here
AS
BEGIN
-- body of the stored procedure
DECLARE @informe INT=0;
DECLARE @tarea_gestion INT=0;
SET @informe = (SELECT informe FROM ln_demo WHERE contraparte=@p_contraparte and gestion=@p_gestion);
SET @tarea_gestion= (
SELECT TOP 1 informes.informe
FROM informes
INNER JOIN LN_tareas ON informes.idTarea=LN_tareas.tipo_tarea
WHERE
informes.informe_padre=@informe
AND LN_tareas.tipo_tarea='E'
);
--
UPDATE LN_demo SET docs_ok = 0 WHERE contraparte=@p_contraparte AND gestion=@p_gestion;
--
IF ( @informe != 0 )
BEGIN
UPDATE informes SET estado_informe='P' WHERE informe=@informe;
END
--
IF ( @tarea_gestion != 0 )
BEGIN
UPDATE informes SET estado_informe='E' WHERE informe=@tarea_gestion;
END
END
GO
GO
-- Create the stored procedure in the specified schema
CREATE OR ALTER PROCEDURE dbo.Revertir_DocsOK_Gestion
@p_contraparte int,
@p_gestion int
-- add more stored procedure parameters here
AS
BEGIN
-- body of the stored procedure
DECLARE @informe INT=0;
DECLARE @tarea_gestion INT=0;
SET @informe = (SELECT informe FROM ln_demo WHERE contraparte=@p_contraparte and gestion=@p_gestion);
SET @tarea_gestion= (
SELECT TOP 1 informes.informe
FROM informes
INNER JOIN LN_tareas ON informes.idTarea=LN_tareas.tipo_tarea
WHERE
informes.informe_padre=@informe
AND LN_tareas.tipo_tarea='E'
);
--
UPDATE LN_demo SET docs_ok = 0 WHERE contraparte=@p_contraparte AND gestion=@p_gestion;
--
IF ( @informe != 0 )
BEGIN
UPDATE informes SET estado_informe='P' WHERE informe=@informe;
END
--
IF ( @tarea_gestion != 0 )
BEGIN
UPDATE informes SET estado_informe='E' WHERE informe=@tarea_gestion;
END
END
GO
Depends On
3Used By
No items found