How to set the account status to inactive for a specific group of users


1. Identify records to update

  • Filter results based on desired criteria, such as user type (UGN.UTY) or current status (UGN.ST)

Example:

SELECT * FROM UGN WHERE DEL = 0 AND ST = 0 AND UTY IN ('USER','TEACHER') 


2. Create a table backup

  • It is recommended to create a backup of the UGN table before making changes

Example:

SELECT * INTO UGN_BACKUP FROM UGN


3. Update the status

  • Set the UGN.ST field to the desired status: 

    • 0 - Active

    • 1 - Locked

    • 2 - Disabled

    • 3 - Pending


Example:

UPDATE UGN SET UGN.ST = 1 WHERE DEL = 0 AND ST = 0 AND UTY IN ('USER','TEACHER')