2025-06-26 18:47:11 +02:00

39 lines
1.0 KiB
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
--[dbo].[sp_change_codfiscale] 'BLSPFR46C30F205L','BLSPLA46C30F205L'
CREATE PROCEDURE [dbo].[sp_change_codfiscale]
-- Add the parameters for the stored procedure here
@nuovo varchar(16),
@vecchio varchar(16)
AS
BEGIN
SET NOCOUNT ON;
begin try
begin
transaction update_cf
update dbo.Cliente
set codEsterno = @nuovo,
codFiscale = @nuovo
where codEsterno = @vecchio
--print @@rowcount
update dbo.C6ReportFisico
set cliente = @nuovo
where cliente = @vecchio
update dbo.C6ReportFisico_CAMPAGNA
set cliente = @nuovo
where cliente = @vecchio
update dbo.LogFilePDF
set codicefiscale= @nuovo
where codicefiscale= @vecchio
update dbo.RepositoryMetadati
set cod_fiscale=@nuovo
where cod_fiscale=@vecchio
commit transaction update_cf
end try
begin catch
rollback transaction update_cf
end catch
END