Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL not working as expected
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01007835
Message ID:
01007839
Views:
9
This message has been marked as the solution to the initial question of the thread.
Brenda,

A string comparison works differently in SQL commands and in the rest of FoxPro. See SET EXACT and SET ANSI for details. With both those settings OFF, "" <> "04" is true in the command window and false in the query. It's better to avoid ALLTRIM() function in the queries WHERE clause. I don't see why do you need ALLTRIM() and UPPER() in this case at all.
 Select * FROM property WHERE key = '00011987' and;
prop_type != '04'
>
>The following SQL returns an empty result set. The prop_type is two spaces. When I am in the command window, both of the SQL Where clauses return .T. when the property record pointer is on the 00011987 key. but when I run the SQL an empty result set is returned. Why?
>
>
 Select * FROM property WHERE key = '00011987' and;
>alltrim(upper(prop_type)) != '04'
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform