Updated sql for active dir. changes