--[sp_writePDF] 999,999,null,null
CREATE PROCEDURE [dbo].[sp_writePDF]
@idReport as int,
@idCliente as int,
@utente as varchar(70) = null,
@img as image = null
AS
BEGIN
	SET NOCOUNT ON;
DECLARE @Identificativo AS INT
BEGIN TRAN
INSERT INTO [dbo].[ReportperClienteDati]
           ([DtCreazione]
           ,[FlgArchiviato]
           ,[IdReport]
           ,[IdCliente]
           ,[Utente])
     VALUES
           (getdate()
           ,0
           ,@idReport
           ,@idCliente
           ,@utente)
SET @Identificativo=@@identity
INSERT INTO [dbo].[ReportFisico]
			   ([FileReport]
			   ,[Identificativo])
		 VALUES
			   (@img
			   ,@Identificativo)
COMMIT TRAN
SELECT @Identificativo as Identificativo
--return @Identificativo
END