Used real SQL for resetpermissions script.