Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select expression for both VFP and SQL DB
Message
 
 
To
29/03/2019 13:44:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01667660
Message ID:
01667726
Views:
33
>>>>Hi,
>>>>
>>>>I have an expression that works SQL Server DB:
>>>>
>>>>select  CAST(0 AS BIT) AS MYFIELD
>>>>
>>>>
>>>>Of course the above will not work for VFP. Is there a way to change the expression above that it would create a calculated logical field in VFP as well as SQL DB?
>>>>
>>>>TIA
>>>
>>>I believe this works in SQL Server (not tested) and for sure in VFP:
>>>
>>>SELECT 1=2 AS MyField
>>>
>>>In MySQL this syntax does not work. I usually refrain from creating boolean fields in the database and prefer single digit numeric values instead (0=false, 1 = true). In MySQL you cannot cast to bool (although the data type exists) and SQL Server boolean datatype does not exist.
>>
>>Thank you. I decided to have two separate expressions, one for SQL and one for VFP.
>
>I found another alternative:
>
>
>PRIVATE plValue
>plValue= .F.
>
>Select  ?plValue AS MYFIELD
>
Thank you. Your approach would work but not in my case. My code is inside a "black" box of the method of an object. And it cannot rely on a variable.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform