KB Issue
Using date format in SQL Server with the wrong date code will give the error that 'now' is not a recognized built-in function name.
Issue Details
When running code in SQL Server, you may encounter the following error.
[Codevalue]Microsoft OLE DB Provider for SQL Server error '80040e14'
'now' is not a recognized built-in function name.
/Load.asp, line 115[/Codevalue]
Recreate Issue
Using now() in SQL Server will result in an error.
Now() is used only in Microsoft Office Access Database.
Resolve Issue
In Microsoft Access Database, we use the following to format our date as a Timestamp.
DATEDIFF('s', LoadDate, now()) as timestamps
Copy
Search Site
Search Google

We are comparing our ColumnName of LoadDate with the Access Date function of NOW() to get a timestamp.
The following lines are broken up.
  • LoadDate
    Copy
    Search Site
    Search Google
    = 2022-04-18 00:00:00.000
  • now()
    Copy
    Search Site
    Search Google
    = 2022-04-21 23:09:56.137
  • timestamp
    Copy
    Search Site
    Search Google
    = 342596
HOWEVER, in SQL Server, we have to use its built-in function, getdate().
DATEDIFF(second, LoadDate, getdate()) as timestamps
Copy
Search Site
Search Google