APMSQL Server query is not returning any rows