Hello,
Although it could be possible to do this with a script, we recommend following one of the options in the KB article mentioned below to delete assets. Note that there are risks involved in running scripts directly on the database.
https://www.lansweeper.com/knowledgebase/deleting-assets/