Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing a string with a field picking up blank 1

Status
Not open for further replies.

hawkieboy

Programmer
Apr 30, 2002
49
0
0
GB
Hi all

I have an application that has ongoing work done to it so it is hard to pick up exactly what was done to make the following happen.

when comparing a string to a field in a table it is not ignoring blanks for example

I am using sql to select records from table

Code:
select * from table where alltrim(name) = "abc"[\code]

the above code does pick all names that begin with abc as you would expect but it also picks up blanks.

example 2

i am testnig a date field to see if the date in the field is > than date()-90 it is reuturning .t. on blank 

both of the above were working correctly a couple of days ago so i suspect it is a setting, not code

any suggestions are appreciated your help and advice is appreciated
 
I think the setting that is most likely to cause this is

SET EXACT ON

for the string comparision, but I would suggest that
you explicitly exclude the blank entries:

Code:
select * from table where alltrim(name) = "abc" and !empty(name)

and

Code:
if !empty(myDate) .and. myDate > date() -90
  ** this is a non-empty, date in the last 3 months
else
  ** this is either empty or older than 3 months
endif

[code]

HTH Regards

Griff
Keep [Smile]ing
 
My apologies

i was being a bit of a flid i have sorted the problem out it was a case of double checking that i was right in what i posted and i was not sorry!

thanks for taking the time to respond to my thread

thanks again your help and advice is appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top