﻿-- Stored procedure
CREATE PROCEDURE [dbo].[HIST_INSERTPDFRESTORATO]
	@img as image = null,
	@idMetadato as int = null
AS
BEGIN
	SET NOCOUNT ON;
--declare @idReport as int
	INSERT INTO [SEIReport].[dbo].[ReportStorico]
          ([identificativo],
           [pdfImage])
     VALUES
		  (@idMetadato,
           @img)
	update repositoryMetadati
	set repository = 3 --(storico)
	where id = @idMetadato
	update repositoryStorico
	set caricamentoInstorico = getDate()
	where id =  @idMetadato
END