Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Logical and SQL Server Bit
Message
 
 
To
13/08/2010 17:40:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01476458
Message ID:
01476525
Views:
59
>>My understanding that SQL Server BIT servers pretty much the same purpose as VFP Logical type column. If I have a table in SQL Server with a column type BIT and a table in VFP with the column type LOGICAL (basically the same-purpose table) can I use the same SQL Select or SQL UPDATE this column?
>>
>>For example, for SQL Server I would have:
>>
>>
>>update MyTable Set MyField = '122'  where NewCol = 0
>>select * from MyTable where NewCol = 1
>>
>>
>>And for VFP the SQL commands would be:
>>
>>update MyTable Set MyField = '122'  where !NewCol
>>select * from MyTable where NewCol
>>
>>
>>Is there a way to make both cases work with the same syntax?
>
>Yes you can use SQL that is common to both VFP and SQL server like this:
>
>
>update MyTable Set MyField = '122'  where cast(NewCol as int) = 0
>select * from MyTable where cast(NewCol as int) = 1
>
>
>PS: Actually you don't even need to do that and would use vanilla ice plain SQL using parameters:
>
>
>MyField = '122'
>newCol = .F.
>
>SQLExec(m.lnHandle, 'update MyTable Set MyField = ?m.MyField  where NewCol = ?m.newCol')
>
>newCol = .T.
>SQLExec(m.lnHande, 'select * from MyTable where NewCol  = ?m.newCol', 'myCursor')
>
>
>Or use simply use cursorschema with CA.
>
>Cetin

Thank you, Cetin.
"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