Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SET ANSI confusion
Message
De
06/12/2005 10:18:36
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Divers
Thread ID:
01075265
Message ID:
01075312
Vues:
18
Still confused. I was referring to uses of "=" within SELECT statements. I had a statement that looked like:

Select * from Mytable left join PartTable on MyTable.part = PartTable.part

Doing this, I got multiple records when I had entries like "KP3 ", "KP31 ", "KP32 " in PartTable. Is this controlled by SET ANSI or SET EXACT? The documentation states:

Unlike SET ANSI, SET EXACT does not apply to Visual FoxPro SQL commands. For more information, see SET ANSI Command.

Thanks


>>I have just learned, much to my chagrin, about SET ANSI ON. Having learned about its existence, I want to make sure I get it right ...
>>
>>It appears that when using '=' within a SELECT statement and SET ANSI OFF, the trailing spaces are ignored, and the comparison is only made up to the length of the shortest string. This "KP3 " = "KP31 ", even though normal VFP string comparison doesn't work this way.

>
>The trailing blanks are not ignored whith SET ANSI OFF so "KP3 " will not equal to "KP31 "
>The string comparison is controlled by SET EXACT. By default it set to OFF in which case comparison is performed to the length of the string on the right.
>
>
>>However, setting SET ANSI ON will compare the strings to their entire lengths, so such mis-matches do not occur. Is this correct? Is there any other effect of SET ANSI ON?
>
>Almost. The shorter string will be padded with spaces to the lenght of the longer one before comparison.
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform