Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String comparisons
Message
From
08/11/2006 13:29:37
 
 
To
08/11/2006 13:19:27
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Miscellaneous
Thread ID:
01168143
Message ID:
01168150
Views:
13
This message has been marked as the solution to the initial question of the thread.
CREATE CURSOR crsTest (Account C(20), balance N(14,2), Value1 N(14,2))
FOR asd = 1 TO 150
    INSERT INTO crsTest VALUES ('01-'+TRANSFORM(asd), RAND()*1000, RAND()*100000)
NEXT
SET ANSI OFF
** You wil get ALL Accounts that starts with '01-10'
SELECT DIST * FROM crsTest WHERE Account BETWEEN '01-10' AND '01-10'
SET ANSI ON 

** Get ONLY '01-10'  Account
SELECT DIST * FROM crsTest WHERE Account BETWEEN '01-10' AND '01-10'
This is tested in VFP 9. I am not sure if VFP6 has SET ANSI command, so if not try:
CREATE CURSOR crsTest (Account C(20), balance N(14,2), Value1 N(14,2))
FOR asd = 1 TO 150
    INSERT INTO crsTest VALUES ('01-'+TRANSFORM(asd), RAND()*1000, RAND()*100000)
NEXT
lcAccFrom = PADR('01-10',20) && 20 is the length of the Account field
lcAccTo   = PADR('01-10',20) && 20 is the length of the Account field

SELECT DIST * FROM crsTest WHERE BETWEEN(Account,lcAccFrom, lcAccTo)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform