HOWTO: Formatting a Date or Time Value to Query an SQL TableLast reviewed: May 19, 1997Article ID: Q145817 |
The information in this article applies to:
SUMMARYIn Visual FoxPro, you can format date type input data as {mm/dd/yy}, or, if you type directly in a date field, as mm/dd/yy. However, when you perform a remote query on an SQL table and format the data in this fashion, an ODBC error is the result.
MORE INFORMATIONIf, in a remote query, you pass date, time, or timestamp values to an SQL table, you need to format the data with the following escape clauses:
=SQLEXEC( nConnHandle, "SELECT * FROM TITLES WHERE
Titles.pubdate<{ts '1995-06-12 12:55:00'}", 'MyCursor')
You can use the following syntax to create a remote view that queries
datetime information:
CREATE SQL VIEW sqldate REMOTE CONNECTION sqldate AS SELECT * FROM ;
dbo.titles WHERE Titles.pubdate<{ts '1985-06-12 12:55:00'}
In the View Designer, ensure that the date, the time, or the timestamp
values are formatted as needed in the Examples field of the Selection
Criteria tab. Once the view is saved, the information in the Examples field
is saved with the view. If the view is opened and modified, the information
disappears and has to be typed back in the Examples field.
Note that when you pass the field name (not a value) as a parameter to a remote query, you do not receive an ODBC error because Visual FoxPro performs a conversion.
REFERENCESODBC 2.0 Programmer's Reference and SDK Guide, pp.50-52, Microsoft Press. |
Keywords : FxinteropOdbc kbinterop vfoxwin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |