cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete custodian managers in DA using SQL query

Harsha_Rachapal
Level 2

We accidentally loaded all users from our AD into DA using ADSynchronization. There are around 60,000 custodians now, while we only need 500 custodian. Can anyone please suggest any helpful solutions? We are looking to delete unwanted custodians using a SQL query. Is there a SQL query to delete multiple custodian managers from DA? Any help is greatly appreciated. Thanks.

1 REPLY 1

Harsha_Rachapal
Level 2

Delete in the below order
----------------------------------
DELETE FROM [dbo].[tblAddress]
WHERE AddressOwnerID = 16369;


DELETE FROM [dbo].[tblAddressUser]
WHERE AddressOwnerID = 16369;

//The below only use if you are planning to delete the Custodian Group as well

DELETE FROM [dbo].[tblPrincipal]
WHERE TargetGroupID = 11;

DELETE FROM [dbo].[tblTargetGroup]
WHERE TargetGroupID = 11;
------------------------------------------------------------------