Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MySQL select 0 as FLD1 returns character field
Message
De
24/05/2006 08:37:06
 
 
À
23/05/2006 15:23:02
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Divers
Thread ID:
01124223
Message ID:
01124500
Vues:
16
This message has been marked as the solution to the initial question of the thread.
>Theo,
>
>Does MySQL have a cast() type function? If so I like to use it to make sure I get the data type I want.
>
>
select cast(0 as int) as fld1, ....
>

It does have a cast function, but as I've already written in the first post it doesn't do any good. The problem is in MyODBC driver (all versions).

I usually do something like this :
select 0 as sel,* from xtable into cursor RsltTable, when I want to add a column that will be used for checking-selecting records.

Anyway, the solution I've come up so far is to create a temporary table with explicit casting for the new fields that I want, and then select this table into vfp.

Something like this :
create temporary table tRsltTable as select cast(0 as unsigned) as sel,a.* from xtable a;
select * from tRsltTable;

(ofcourse you should use them via sqlexec, or with an adapter class if you use one..)

ps. mysql doesn't support the "select .... into #table" syntax tha msSql has, so I use the "create temporary..." thing.

Hope this is usefull to other coders...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform