SQL script Accounts table depth_of_account & subaccount_ids

MikkiMilligan
Community Explorer

We are migrating from CD1 to CD2. In the accounts table the depth_of_account column is a calculation. Does anyone have SQL script to calculate the depth_of_account hierarchy and the subaccount_ids? 

Currently, my script has hard-coded values - this is just a temporary fix. If the end user updates the accounts from the front end, we would have to manually update the script, which is not best practices.

Thank you, 

Mikki

Labels (3)