Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SmallDateTime in MSSQL to Date in VFP
Message
From
23/10/2003 19:15:54
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00841887
Message ID:
00841902
Views:
27
>>>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.
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform