Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SmallDateTime in MSSQL to Date in VFP
Message
 
 
To
23/10/2003 19:15:54
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00841887
Message ID:
00841905
Views:
39
>>>>How do you make a field/column retrieved from SQL server where it is type SmallDateTime to just Date in VFP? The cursor is retrieved using SPT.
>>>>
>>>>I tried the following:
>>>>
>>>>
>>>>DBSetProp("v_invoice.invoice_date","Field","DataType","D")
>>>>
>>>>
>>>>But it has not effect.
>>>>
>>>>TIA.
>>>
>>>Seems to work fine to me.
>>>Did you just Requery() the view, or did you close it and USE it again? I find myself doing that sometimes.
>>
>>I didn't Requery the view since this is not exactly a view but a cursor retrieved from SQL server using SQLEXEC().
>
>oic - DBSetProp() will only change the data type for a view field, it won't affect SPT calls at all.
>
>Using SPT (i.e., SQLEXEC()) I think you'll have to do this by changing the SQL statement to convert the date in SQL Server to [small]datetime at midnight (to take time out of it), e.g.
>
>
-- sql server t-sql code
>select convert(smalldatetime, convert(varchar, date_col, 101)) as date_col...
>and then deal with date display/calculations in the VFP code, e.g., if you have to calculate date difference between dates, etc. Of course, if you need that kind of calculation, you could also let SQL Server handle that, as well.

I am not familiar with the function convert() so I will have to look it up. It must be a SQL Server function as I don't see it in the VFP 8 help.

Thank you for your help.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform