Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Order By in a Union
Message
De
04/05/2009 01:04:59
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01397707
Message ID:
01397716
Vues:
40
I agree, for a one-SQL statement, but...

In this case ( a Sql UNION), I am pulling from a template table in the 1st SQL call to get the structure (no nvl() used here), then UNIONing in a second data collection, that does use NVL(vendor, '') to match up to the first SQL. I think in this case, the 1st one is setting the width, so the second sql only needs to supply a string data type (of any length) to fill in the already-established schema from the first SQL. From the 2nd SQL, a shorter string is padded automatically, longer one would get truncated.

That's what I am seeing happen.



>>Actually, it seems to work fine without the padding. I would have thought that would not work, but it does.
>>
>>Well, at least I can say it does work when there is at least one non-null in the testdata group. I should test for all nulls in testdata, and maybe then it would fail.
>>
>
>The width of the field is determined by the first matching record. If the first matching record is a .NULL. value then your field will be set to the width of '' as defined in your: NVL(somefield,'')
>
>
>This is a gotcha that has gotten me.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform