I'm with Tony. I never rely on SQLCODE to give me an error condition. I do a count(*) first. I've heard quite a few stories of SQLCODE giving different results based on the computer's operating system. And if my count(*) is based on a large table, I will always add "and limit = 1" to the end of my Select so that it stops counting as soon as it finds one record.
Karen In a message dated 1/4/2012 1:41:53 PM Central Standard Time, [email protected] writes: > Marc, > > My way of dealing with this kind of queries is to make use of a COUNT, > like: > > Set var V_Count integer = 0 > > Select count(*) into V_Count indicator V_Count_ind + > from <tableview> + > > WHERE (cust1 = .vcust1 OR cust2 = .vcust1 OR cust3 = .vcust1 + > OR cust4 = .vcust1) AND aptdate >.#DATE > > If V_Count = 0 then > > PAUSE 1 USING 'Needs to make an Apt' CAPTION 'No APts set' > ENDIF > > > > BTW Have you noticed the RETURN after ENDIF. > > The routine will stop at that point > > > > Tony > > >

