An ODBC error may occur when you update the DateTime data in Microsoft SQL Server 7.0 or later versions and in Visual FoxPro (253886)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Windows 7.0
- Microsoft Visual FoxPro 8.0
- Microsoft Visual FoxPro 9.0 Professional Edition
This article was previously published under Q253886 SYMPTOMS
When the DateTime data type is updated from remote views, an ODBC error may occur if the DateTime data type is first populated in Microsoft SQL Server 7.0 or later versions. This issue occurs in SQL Server 7.0, in SQL Server 2000, or in Microsoft Data Engine. An update conflict occurs because of the difference in the precision with which SQL Server 7.0 or later versions store DateTime data and the precision with which Microsoft Visual FoxPro stores DateTime data.
The precision in SQL Server 7.0 or later versions is in milliseconds. The precision in Visual FoxPro does not include milliseconds. When the data is updated, the ODBC Driver detects the milliseconds in SQL Server 7.0 or later versions. Then, the ODBC Driver incorrectly interprets that the data has been updated. This creates an update conflict.
WORKAROUND
There are three different workarounds for this problem. Any one of them must be accomplished against the SQL Server database.
- Change the DateTime data type to a SmallDateTime data type.
Create a stored procedure that returns the data stored in SQL Server in a converted format with millisecond precision removed. For example:
(convert(datetime,convert(char,getdate())))
If you are setting a default date in the column, use the following code to remove the millisecond precision:
(convert(datetime,convert(char,getdate())))
- Create a stored procedure that returns the data stored in SQL Server in a converted format with millisecond precision removed. For example:
(convert(datetime,convert(char,getdate())))
If you are setting a default date in the column, use the following code to remove the millisecond precision:
(convert(datetime,convert(char,getdate())))
- If you are setting a default date in the column, use the following code to remove the millisecond precision:
(convert(datetime,convert(char,getdate())))
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 3/18/2005 |
---|
Keywords: | kbCodeSnippet kbDatabase kbprb kbSQLProg KB253886 |
---|
|