106 lines
3.4 KiB
Transact-SQL
106 lines
3.4 KiB
Transact-SQL
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
-- RSIMLS46A45B670G RSIMLS46A46B670I
|
|
-- RMNVLM40L50H027T RMNWLM40L50H027U
|
|
--srv_change_codfiscale 'BRGPNG47C50F382V','FRNNLN53D59A757M',1
|
|
--srv_change_codfiscale '04920830827','04020830827','0',0
|
|
CREATE PROCEDURE [dbo].[srv_change_codfiscale]
|
|
-- Add the parameters for the stored procedure here
|
|
@nuovo varchar(16),
|
|
@vecchio varchar(16)
|
|
--FC 03/10/2014
|
|
--Aggiunto Parametro gestione CF o P.I.
|
|
-- 1 = CF
|
|
-- 0 =P.I.
|
|
,@isCodFis int
|
|
,@retcodErr int output
|
|
AS
|
|
BEGIN
|
|
--SET NOCOUNT ON;
|
|
--toDo FC
|
|
begin try
|
|
-- begin transaction update_cf
|
|
--------GIORNALIERO---------------------------------------------
|
|
-- update C6Mart.CONTRATTOSEI
|
|
-- set Cod_Fiscale = @nuovo
|
|
-- where Cod_Fiscale = @vecchio
|
|
update C6Mart.GESTIONE_PDF_FTP
|
|
set CodiceFiscale = @nuovo
|
|
where CodiceFiscale = @vecchio
|
|
update c6Mart.gestione_email
|
|
set cod_fiscale = @nuovo
|
|
where cod_fiscale = @vecchio
|
|
--------TRIMESTRALE---------------------------------------------
|
|
update C6StagingPeriodico.ContrattiPretrimestrale
|
|
set Cod_Fiscale = @nuovo
|
|
where Cod_Fiscale = @vecchio
|
|
update C6StagingPeriodico.APPO_CONTRATTI
|
|
set Cod_Fiscale = @nuovo
|
|
where Cod_Fiscale = @vecchio
|
|
update C6MartPeriodico.CONTRATTOSEI
|
|
set Cod_Fiscale = @nuovo
|
|
where Cod_Fiscale = @vecchio
|
|
update C6MartPeriodico.ANAG_CLIENTI
|
|
set Cod_Fiscale = @nuovo
|
|
where Cod_Fiscale = @vecchio
|
|
update C6MartPeriodico.controllo_trimestrale
|
|
set Cod_Fiscale = @nuovo
|
|
where Cod_Fiscale = @vecchio
|
|
update C6MartPeriodico.GESTIONE_PDF_FTP
|
|
set CodiceFiscale = @nuovo
|
|
where CodiceFiscale = @vecchio
|
|
update C6MartPeriodico.CRUSCOTTO_CONTRATTISEI
|
|
set CodiceFiscale = @nuovo
|
|
where CodiceFiscale = @vecchio
|
|
-- Sul Sei tabella Cliente il CF è diviso per categoria P.I.V.A. o Cod. Fiscale
|
|
IF @isCodFis = 1
|
|
Update C6STAGINGPERIODICO.RP_InfoCliente
|
|
set codfis =@nuovo
|
|
where codfis = @vecchio
|
|
IF @isCodFis = 0
|
|
Update C6STAGINGPERIODICO.RP_InfoCliente
|
|
set piva =@nuovo
|
|
where piva = @vecchio
|
|
-- Sul Sei tabella Cliente il CF è diviso per categoria P.I.V.A. o Cod. Fiscale
|
|
IF @isCodFis = 1
|
|
Update [CONSEVO_PERIODICO].ConsulenzaBase.dbo.Cliente
|
|
set codfis =@nuovo
|
|
where codfis = @vecchio
|
|
IF @isCodFis = 0
|
|
Update [CONSEVO_PERIODICO].ConsulenzaBase.dbo.Cliente
|
|
set piva = @nuovo
|
|
where piva = @vecchio
|
|
--EXEC [VMBFDSREPSEI01\I1].[seireport].dbo.sp_change_codfiscale @NUOVO,@VECCHIO
|
|
-- update [VMBFDSREPSEI01\I1].[seireport].dbo.Cliente
|
|
-- set codEsterno = @nuovo,
|
|
-- codFiscale = @nuovo
|
|
-- where codEsterno = @vecchio
|
|
--
|
|
-- update [VMBFDSREPSEI01\I1].[seireport].dbo.C6ReportFisico
|
|
-- set cliente = @nuovo
|
|
-- where cliente = @vecchio
|
|
--
|
|
-- update [VMBFDSREPSEI01\I1].[seireport].dbo.C6ReportFisico_CAMPAGNA
|
|
-- set cliente = @nuovo
|
|
-- where cliente = @vecchio
|
|
--
|
|
-- update [VMBFDSREPSEI01\I1].[seireport].dbo.LogFilePDF
|
|
-- set codicefiscale= @nuovo
|
|
-- where codicefiscale= @vecchio
|
|
--toFC
|
|
--commit transaction update_cf
|
|
select @retcodErr=0
|
|
--select * from C6Mart.gestione_email where cod_fiscale='VGNLSI31D47D526G'
|
|
--select * from C6Mart.CONTRATTOSEI where cod_fiscale=@nuovo
|
|
--toFC
|
|
end try
|
|
begin catch
|
|
-- --print('errore')
|
|
-- select 'CF : '+@nuovo CodFiscale,@@error codErr,ERROR_MESSAGE() errMss
|
|
--rollback transaction update_cf
|
|
select @retcodErr=-1
|
|
end catch
|
|
END |