Local Account Cleanup

Local Account Cleanup

For some reason some we have a bunch of local users SDP that have no tickets and are just setting there.  I would like to clean them up, but don’t  want to go through the web interface.  I was looking at the backend databases and I think that if I just change the “Status” field in the SDUser table to “RESIGNED” on the users that would be the same as deleting them through the web interface.   Do I need to change anything else in the database to delete the users or is that it?  I have written the following query if that is the case:

SELECT USERID,FIRST_NAME FROM SDUser LEFT JOIN AaaUser ON SDUser.USERID=AaaUser.USER_ID WHERE STATUS = 'ACTIVE' AND DOMAIN_ID IS NULL AND NOT EXISTS(SELECT * FROM WorkOrder WHERE SDUser.USERID=WorkOrder.REQUESTERID) AND NOT EXISTS(SELECT * FROM WorkOrderStates WHERE SDUser.USERID=WorkOrderStates.OWNERID)

                  New to ADSelfService Plus?