﻿-- Stored procedure
CREATE PROCEDURE [dbo].[C6_U_ArchiviaDocumento]
@idDocument as int,
@image as image = null
AS
BEGIN
	SET NOCOUNT ON;
	UPDATE [dbo].[ReportperClienteDati]
	SET  FlgArchiviato = 1
    WHERE Identificativo = @idDocument
	UPDATE [dbo].[REPORTFISICO]
	SET  FileReport = @image
    WHERE Identificativo = @idDocument
	--V
	update repositoryMetadati
	set flagLock = 1 where idInRepository = @idDocument and repository = 0
END