开发者

Invalid Procedure Call on DateDiff with MS Access Driver

开发者 https://www.devze.com 2023-02-05 09:29 出处:网络
The following query: SELECT DateDiff(\'month\',0,\'2000-01-01 00:00:00\'); Returns a \"[ODBC Microsoft Access Driver] Invalid procedure call\" error, with the bizarre code of 22018.

The following query:

SELECT DateDiff('month',0,'2000-01-01 00:00:00');

Returns a "[ODBC Microsoft Access Driver] Invalid procedure call" error, with the bizarre code of 22018.

Specs:

  • Microsoft Access Driver version: 4.00.6305.00
  • Database created with Access 2003

The above appears to be the proper syntax, as c开发者_如何转开发alling the function with the current format (no single quotes for month), returns "[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1."

So, what is the proper syntax, if I did not get it right? Alternatively, how do I perform a datediff with that version of the driver?


I don't understand how ODBC is involved, but your query won't work in a pure Access context because DateDiff requires "m" as the interval argument for month.

Within Access 2003, this query returns 1201:

SELECT DateDiff('m',0,'2000-01-01 00:00:00');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号