IF NOT OBJECT_ID('P_EST_NF_ENT_DANFE_PROVISORIO_LIBERACAO_ENTRADA') IS NULL
        BEGIN
            DROP PROCEDURE P_EST_NF_ENT_DANFE_PROVISORIO_LIBERACAO_ENTRADA 
        END
go
--EXEC P_EST_NF_ENT_DANFE_PROVISORIO_LIBERACAO_ENTRADA
CREATE PROCEDURE P_EST_NF_ENT_DANFE_PROVISORIO_LIBERACAO_ENTRADA (@CD_CTR INT,@CD_USU INT)
AS 

INSERT INTO EST_NF_ENT_DANFE_PROVISORIO_LIBERACAO_ENTRADA
(CD_CTR, CD_USU, ERROS_XML)
SELECT CD_CTR, @CD_USU, ERROS_VALIDACAO FROM EST_NF_ENT_DANFE_PROVISORIO_ERROS_VALIDACAO WHERE CD_CTR =@CD_CTR;
DELETE FROM EST_NF_ENT_DANFE_PROVISORIO_ERROS_VALIDACAO WHERE CD_CTR = @CD_CTR;