Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I add an empty logical field to my SQLselect?
Message
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 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01207912
Message ID:
01207972
Vues:
14
>>Hallo.
>>If I want to add an extra empty field when I do a SQLselect i do like this:
>>
>>sqlexec(nHandle,"select Table1.*, space(19) as extrafield from Table1","Mytable")
>>
>>for an extra character field,
>>
>>sqlexec(nHandle,"select Table1.*, 0 as extrafield from Table1","Mytable")
>>
>>for an extra integer field,
>>
>>sqlexec(nHandle,"select Table1.*, alltrim(space(256)) as extrafield from Table1","Mytable")
>>
>>for an extra memo field... and so on.
>>
>>BUT, how do I do if I want an extra logical field???
>>I cant use a zero because it will result in an integer field, and I have tried 'false', and even an 'L'. (The 'L' was a last desperate try, when nothing else worked :-) )
>>Nothing I do works, so I will ask if someone knows how to add an empty logic field to my SQLselect???
>>
>>Thanks
>>/Kjell
>
>
>Kjell,
>I saw your backend is SQL Server, BUT in SQL Server there is NO ALLTRIM() function, If you use SQL Server you could use this to get an logical field:
>
>sqlexec(nHandle,"select Table1.*, CAST(0 AS Bit) as extrafield from Table1","Mytable")
>
>If you use VFP:
>
>sqlexec(nHandle,"select Table1.*, .f. as extrafield from Table1","Mytable")
>
Thankyou for your answer. It worked fine with "CAST(0 AS Bit)". I tried CAST before, but I used the word "Logical" instead of "Bit", so it did not work for me.
Yes, saw the error when I had saved the message. It should be Ltrim or Rtrim instead of alltrim in the SQLselect abowe.

But when I see your answer about the empty logical field, maybe it is better to use "CAST('' AS Text)" instead of "Ltrim(space(256))".

Thanks again
/Kjell
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform