Cannot delete site and department

Cannot delete site and department

Hello!

We are trying to delete a department and its respective site but when we delete it, it become greyed out and informs us that site/department is used by a module. The name of the department and site is 'Assistive Technology'

I have tried the following code below to delete a site, running a query in the ServiceDesk Database in the SQL Server
Assistive Technology Site ID = 609

update Workorder set slaid=null where slaid in (select slaid from sladefinition where siteid in (609));
update Workorder set siteid =null where siteid in (609);
update workorder set deptid= null where deptid in (Select deptid from departmentdefinition where siteid in (609));
delete from userdepartment where deptid in (Select deptid from departmentdefinition where siteid in (609));
update resourceowner set deptid= null where deptid in (Select deptid from departmentdefinition where siteid in (609));
update resourceownerhistory set deptid= null where deptid in (Select deptid from departmentdefinition where siteid in (609));
update PurchaseCCDepartment set deptid= null where deptid in (Select deptid from departmentdefinition where siteid in (609));

However all the results come up as 0 rows affected!

If I try to create a new asset and choose the Site Combo, the name does not show up in here! But it still remains in the List of Sites but greyed out!

Can someone pass the correct code so that I can delete both the department and the site.

Kind Regards, Sheldon

PS: ManageEngine Service Desk Version: 9.1 Build 9106 | SQL Server 2008 R2

                  New to ADSelfService Plus?