fix SQL for MS SQL at method getUsers
several minor issues