CREATE procedure [C6MartPeriodico].[UpdateStatoReport](@FiscalCode nvarchar(max), @Rete nvarchar(max)) as begin insert into dbo.logn(message, level, logged, application) select 'UpdateStatoReport:'+@fiscalCode+@Rete, 'Info', getdate(), 'Trimestrale' update C6MartPeriodico.controllo_trimestrale set stato_report = 4 where COALESCE(cod_fiscale,'R')=COALESCE(@FiscalCode,'R') and COALESCE(rete,'R') =COALESCE(@Rete,'R') end