Missing Account in Fee Database

Created by Hamta Fakhravar, Modified on Tue, 2 Apr, 2024 at 9:57 AM by Hamta Fakhravar

----  Process crashing to due to records count difference in code  -- Code needs to be re-written at some point as it is not working well right now

---- Script run to manually update things first
    SELECT DISTINCT COALESCE(CustRollup,'') CustRollup,COALESCE(CustRollupName,'') CustRollupName
        INTO #step1_rollups
        FROM CentralCommand.schReporting.tb_TB0001_RsrcTb
        WHERE CustRollup is not null

DROP TABLE #S2

SELECT distinct c.client_id, c.Name, LEFT(r.CustRollupName,50) New_name, c.master_customer_rollup_name, LEFT(r.CustRollupName,50) new_master_customer_rollup_name
        INTO #S2
        FROM client c
        JOIN  #step1_rollups r        ON (r.CustRollup COLLATE SQL_Latin1_General_CP1_CS_AS=COALESCE(c.client_id,''))
        WHERE LEFT(r.CustRollupName,50)<> COALESCE(name,'')     
            OR  LEFT(r.CustRollupName,50) <> COALESCE(master_customer_rollup_name ,'')

SELECT    *
  FROM    #S2

UPDATE c
SET name = r.New_name
    ,master_customer_rollup_name=r.new_master_customer_rollup_name
    ,is_active=1
-- SELECT    *
FROM    client c
        JOIN  
        #S2 r        ON c.client_id=r.client_id
--ORDER BY c.client_id

---- 114 records updated

Ran final process again by running "Reporting_Import_ImportNewCustidsFromAgresso" job -   process now ran successfully   --  account now exists    
Verified they exist
-- DTIHASQL (Reporting DB)
SELECT *
  FROM [Reporting].[dbo].[account]
  where account_id in ('????????')

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article