How to delete Company in MSD axapta using sql script

How to delete Company in axapta using sql script
sp_MSforeachtable is a stored procedure which can be used to  delete all records of a specific company using sql editor . Sometimes we not able to delete company from ax due to large size then this script example can be helpful for you.

 EXEC sp_MSforeachtable 'delete from ? where ?.DataAreaID = "TEST"'  
 DELETE FROM DataArea WHERE DataArea.ID = 'TEST'  
 DELETE FROM CompanyDomainList WHERE CompanyDomainList.CompanyID = 'TEST'  

Same steps you can repeat for other companies.