Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String comparaison
Message
 
 
To
22/06/2022 09:16:57
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684533
Message ID:
01684557
Views:
38
Likes (1)
>>>Hi,
>>>
>>>Add next row to your code:
>>>
>>>SET COLLATE TO "MACHINE"
>>>
>>>
>>>For other collates can be "GALA"= "Gala"
>>>
>>>MartinaJ
>>>
>>>>*Cursor with unique list of string
>>>>CREATE CURSOR c_UniqueString (cStr C(50))
>>>>
>>>>*Cursor where we want to find all unique string from.
>>>>CREATE CURSOR c_Data (cCode C(40), cdesc C(50))
>>>>
>>>>INSERT INTO c_data (ccode, cDesc) VALUES ("ARIA", "Ariane")
>>>>INSERT INTO c_data (ccode, cDesc) VALUES ("GALA", "Gala")
>>>>
>>>>SET EXACT ON
>>>>SET ANSI ON
>>>>
>>>>*First column
>>>>SELECT DISTINCT CAST(RTRIM(cCode) AS V(40)) as string FROM c_data WHERE !ISNULL(cCode) INTO CURSOR c_DistinctCode
>>>>
>>>>INSERT INTO c_UniqueString (cStr) SELECT string FROM c_DistinctCode WHERE string NOT IN (SELECT cStr FROM c_UniqueString)
>>>>
>>>>*Second column
>>>>SELECT DISTINCT CAST(RTRIM(cdesc) AS V(40)) as string FROM c_data WHERE !ISNULL(cdesc) INTO CURSOR c_DistinctDesc
>>>>
>>>>INSERT INTO c_UniqueString (cStr) SELECT string FROM c_DistinctDesc WHERE string NOT IN (SELECT cStr FROM c_UniqueString)
>>>>
>>>>*We should have 4 values in c_UniqueString, but we are missing Gala in lower case. The NOT IN does not take into account Lowercase and UpperCase.
>>>>
>>>>Any work around ?
>>
>>Right on Martina!
>>
>>By default our SET COLLATE TO is set to General because of the French language in our Province.
>>It just byte us with some SQL queries.
>>
>>Thanks a lot for this finding.
>>Like Lutz mentioned, it's kind of a fine print.
>
>Luc
>
>I only remember that, 25 years ago, the general recommendation was to use MACHINE. I have done so and never touched it.
>If you have trouble with some special fields, set general COLLATE TO MACHINE and consider
>
>INDEX ON ....  COLLATE cCollateSequence
>
>for the tags where you need it special. Maybe a tag only use for display. (For me, I do all on CA, so it would be on the CA)
>This works with the ALTER TABLES too.
>
>It has it odds as well.

I know what you are referring to, I was there 25 years ago ;-)

But since, we are un Quebec Canada and customer are mostly French Canadian.
We switch to SET COLLATE TO GENERAL for string values

So if we search "Québec" in field value "Quebec" it would be found.
Since then we forgot about it and like Martina mention, it had an impact in some of our queries

Have a nice weekend all. Québec Day tomorrow.
Luc Nadeau
lnadeau@neova.ca

"the theory, it is when all is known and that nothing works. The practice, it is when all works and that nobody knows why." - Albert Einstein (Nobel of physique 1921)
Previous
Reply
Map
View

Click here to load this message in the networking platform