SQL statement for Access 2010 DB does not work with ODBC

I am trying to run a simple statement to access a database to search for records.

Checking the data in the records was terrible, and I cannot sanitize it. Value, it must be saved as is.

I need to be able to search for a string with a space and hyphen characters. The following statement will work in Access 2010 direct:

select * from dummy where Replace(Replace([data1],' ',''),'-','') = 'ABCD1234';

Running it from an ODBC connection through PHP will not. It raises the following error:

SQL error: [Microsoft][ODBC Microsoft Access Driver] Undefined function 'Replace' in expression., SQL state 37000 in SQLExecDirect

Creating a query in a database that runs this function and tries to look for its values ​​indirectly causes the same error:

select * from dummy_indirect where Expr1 = 'ABCD1234';

I tried using both ODBC drivers. ODBCJR32.dll (03/22/2010) and ACEODBC.dll (02/18/2007). As far as I know, they should be current as they were installed with the full Access 2010 and Access Database Database Engine.

, , . , , . mdb, , .

* *

OleDB .

$dsn= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\dummy.mdb;";

-. .

, , Access . , . , API Apache/PHP, , .

- , , (Autonumber ). ( ), , , - , -, LIKE .

replace(), , ODBC- , , ?

+5
2

, db Replace(), Access. Access "Undefined". , ODBC OleDb . Replace(), ( Access db) .

. , . , . Replace(), , , (0) . . , .

Replace(), , . , Like. , 4 , , 4 , WHERE, , "ABCD1234":

SELECT * FROM dummy
WHERE
       data1 = 'ABCD1234'
    OR data1 Like 'ABCD[- ]1234';

- :

SELECT * FROM dummy
WHERE
       data1 IN ('ABCD1234','ABCD 1234','ABCD-1234');

, , . , :

  • , db . , db , .
  • Access db SQL Server , SQL Server.
  • Surrender.:-( PHP- , , .
+4

, ODBC . MS Access ( MS , SQL Server ).

OLEDB? .

-2

All Articles