Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not UNION compatible
Message
De
27/02/2002 09:39:14
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00625709
Message ID:
00625711
Vues:
10
>Can anyone see why the following to cursors would NOT be union compatible?

The fields have to have the same type and the same size. Even the same number of decimals, in the case of numeric data. The names of the resulting fields don't need be the same.

What strikes me as weird in your code is: space(0) as cCompanyName. Since a field can't have 0 bytes, VFP might substitute a 1-byte character field. Which would not be compatible with any larger character field.

HTH, Hilmar.

>
>
Select invoice.pk_id, ;
>	invoice.dinvDate As invDate, ;
>	invoice.cCompanyName, ;
>	invoice.cInvNum, ;
>	invoice.cprojectnum, ;
>	invoice.cprojectName, ;
>	invoice.cJobNum, ;
>	invoice.cJobName, ;
>	{} As pmtDate, ;
>	00000000.0000 As pmtAmount, ;
>	Space(50) As cRef, ;
>	"I" As rowType ;
>	from invoice ;
>	where invoice.pk_id In ;
>	(Select pk_id From rsOutInv) ;
>	order By invoice.cInvNum ;
>	into Cursor rsJustInvs
>
>Select Payment.fk_invoice_id, ;
>	{} As invDate, ;
>	Space(0) As cCompanyName, ;
>	Space(0) As cInvNum, ;
>	Space(0) As cprojectnum, ;
>	Space(0) As cprojectName, ;
>	Space(0) As cJobNum, ;
>	Space(0) As cJobName, ;
>	payment.dDate As pmtDate, ;
>	payment.yAmount + yTax As pmtAmount, ;
>	payment.cRef, ;
>	"P" As rowType ;
>	from Payment ;
>	where Payment.fk_invoice_id In ;
>	(Select pk_id From rsOutInv) ;
>	order By Payment.fk_invoice_id ;
>	into Cursor rsJustPayments
>
>And the union:
>
>
Select * From rsJustInvs ;
>	union ;
>	select * From rsJustPayments ;
>	into Cursor rsPrint
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform