Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SELECT and code pages problem
Message
From
25/07/2001 23:50:38
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL SELECT and code pages problem
Miscellaneous
Thread ID:
00535512
Message ID:
00535512
Views:
44
Hi!

I'm running VFP6 (SP5) on Czech Windows 98 SE and have the following problem
in SQL-SELECT with comparing character data from these tables:
- two tables in the FoxPro 2.6 (DOS) format, code page 895 (Kamenicky)
with structure (Klic Character 1, Value Numeric 3) and 256 records
with values from CHR(0),0 to CHR(255),255. These tables are identical.
They have no indexes.

After running the following code

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE K1.Klic == K2.Klic ;
ORDER BY 2

I get only 245 records in the result with statements that 176=95, 177=95,
record for code 172 is missing etc. I expected 256 records with identical
values :-((

By modifying the code to the following

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

SELECT Keys
SET NOCPTRANS TO Klic
SELECT Keys2
SET NOCPTRANS TO Klic

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE K1.Klic == K2.Klic ;
ORDER BY 2

I get only 128 records in the result (for codes 0 - 127).

After getting the code to the following variation (much slower in run)

SET COLLATE TO "MACHINE"
USE i:\fox\keys IN 0 SHARED
USE i:\fox\keys2 IN 0 SHARED

SELECT Keys
SET NOCPTRANS TO Klic
SELECT Keys2
SET NOCPTRANS TO Klic

sele * FROM KEYS K1, KEYS2 K2 ;
WHERE MyFun(K1.Klic,K2.Klic) ;
ORDER BY 2

FUNCTION MyFun
LPARAMETERS tc1,tc2

RETURN tc1==tc2

I finally got the correct result (256 records with identical values).

Does it mean VFP is not capable of comparing values from tables
directly in the SQL-SELECT ?? Or what am I doing wrong ?
Any ideas ?
Pavel Kouril
Next
Reply
Map
View

Click here to load this message in the networking platform