Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hacker Guide Question
Message
De
28/02/2002 06:56:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00625768
Message ID:
00626272
Vues:
11
>>>That's the same version I'm running. I wonder if it was different in VFP6, I don't have it to test.
>>
>>It does not work in VFP6 SP5 either. I can't test any earlier than that. Looking at the help for error 1851 (Selects are not UNION compatible), it says "Data types or sizes of fields being projected in each SELECT statement are not identical" (emphasis mine).
>
>I need to amend my initial reply here. What does not work is a union where the same field in the second query is a smaller size. For example
SELECT cName FROM mytable UNION SELECT cName FROM someothertable
results in error 1851 if cName is C(10) in mytable and C(1) in someothertable (i.e., smaller but not identical).
>
>No error is generated if you use space(1) in the second query
SELECT cName FROM mytable UNION SELECT SPACE(1) FROM someothertable
although the result is not necessarily what one would expect.

As I wrote previously, I think expressions, not identical to fields, are accepted, but fields are not, for the unequal length.

The following caused an error (not union-compatible) for me (ArtCode C(8), ArtName C(30)):
select ArtName from ArticleMain;
  union select ArtCode from ArticleMain
The following (logically equivalent) did not:
select ArtName from ArticleMain;
  union select padr(ArtCode, 8) from ArticleMain
It seems that converting the field to an expression bypassed the comparison for exact field lengths.

The example, of course, is completely useless.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform