﻿--[dbo].[SP_PDF_RICHIESTARESTORE] 65,'M'
 CREATE PROCEDURE [dbo].[SP_PDF_RICHIESTARESTORE]
	@IdPdf AS BIGINT,	 
	@idProvenienza varchar(1) 	-- SELECT * FROM ProvenienzaPdf
AS
BEGIN
BEGIN TRANSACTION
declare @tds as datetime
declare @ROWCOUNT as int
set @tds = GETDATE()
set @ROWCOUNT = 0
UPDATE DocumentiPdf SET idArchivio = 'C'  WHERE  idArchivio = 'A'  AND idPdf = @IdPdf
set @ROWCOUNT = @@ROWCOUNT
INSERT INTO LogPdf (idPdf,dtstamp,idLogEvent,idProvenienza )	 
		SELECT  @IdPdf,
				@tds,
				8 as idLogEvent,
				@idProvenienza 
 COMMIT TRANSACTION	   
	   select @ROWCOUNT
end