CREATE PROCEDURE [dbo].[SP_PDF_RESTOREIMAGE]
	@IdPdf AS BIGINT,
	@Image as image = null,
	@idProvenienza varchar(1) 	-- SELECT * FROM ProvenienzaPdf
AS
BEGIN
BEGIN TRANSACTION
declare @tds as datetime
set @tds = GETDATE()
UPDATE ImagePdf SET  [Image] = @Image WHERE idPdf = @IdPdf
UPDATE DocumentiPdf SET [idArchivio] = 'R', [dtRestore] = @tds  WHERE idPdf = @IdPdf
INSERT INTO LogPdf (idPdf,dtstamp,idLogEvent,idProvenienza )	 
		SELECT  @IdPdf,
				@tds,
				7 as idLogEvent,
				@idProvenienza 
 COMMIT TRANSACTION	   
end