GETDATE() throwing exception

前端 未结 3 587
后悔当初
后悔当初 2021-01-18 00:08

I am creating a simple application where i am using MSAccess as database. When i am trying to retrieve the data using below query - i am getting exception <

相关标签:
3条回答
  • 2021-01-18 00:28

    GETDATE() is not a function inside MSAccess. The equivilant would be:

    Now() provides date and time

    Date() provides the date

    Time() provides the time

    0 讨论(0)
  • 2021-01-18 00:31

    In MS ACCESS equivalent of GETDATE() is DATE()

    0 讨论(0)
  • 2021-01-18 00:32

    Now that you moved past the first problem (there is no GETDATE() function in Access SQL), you have discovered another problem.

    The DateAdd Function requires a "String expression that is the interval of time you want to add" as its first argument, Interval. But you're giving it MM instead:

    DATEADD(MM, DATEDIFF(MM, 0, DATE()) - 0 , 0)
    

    I don't understand what interval you're trying to add. If you want to add minutes, use ...

    DateAdd('n', ...
    

    If you want to add months, use ...

    DateAdd('m', ...
    

    If you want to add days, use ...

    DateAdd('d', ...
    

    Note DateDiff() also expects an Interval string argument and the allowable values are the same as those for DateAdd().

    0 讨论(0)
提交回复
热议问题