We are able to delete a company in AX, but deleting a partition is not possible.
So why not? It should be easy to create a partition and put data in it with tools like DMF, to enable us to create ad hoc demo / training partitions. Having played for a while with some SQL code, the following code was obtained.
First browse the partitions table to find the RecId of the partition one wants to delete.
The script below contains SQL code to delete PS, EXT and Cube partitions.
Be careful don’t delete the initial partition or a partition with production data. Also note that it will not ask for a confirmation when you run this script. I would strongly recommend you to create a backup of the database before running this.
This script is ‘as-is’. There are no guarantee on this code. I you use it, test it carefully. The results are your responsibility.
It is also possible to delete a company in AX 2012, however you have to delete first all transactions with class sysDatabaseTransDelete (see also http://daxture.blogspot.nl/2014/09/delete-legal-entities-in-ax-2012.html)
As a side not, cleaning up the partition on the Contoso demo data will not reduce the size of your database.