Access database (mdb file), format() function and ODBC/PHP

Can You tell a difference between

SELECT *, format(Data_ur, "yyyy-mm-dd") AS Datur FROM Czlonkowie


SELECT *, format(Data_ur, 'yyyy-mm-dd') AS Datur FROM Czlonkowie


It turns out that when using ODBC to connect to Microsoft Access database (in an mdb file), one has to use single quotes when writing function parameters. The first statement runs fine from the Access itself, but when called through the ODBC (for instance when using PHP and PDO) it returns empty set (it doesn’t even throw an exception).

The second statement (with single quotes) runs fine through ODBC. Worth remembering.

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *