Jira issue originally created by user jue:
In the example in the documentation http://doctrine-dbal.readthedocs.org/en/2.0.x/reference/data-retrieval-and-manipulation.html#dynamic-parameters-and-prepared-statements there is the following example:
$sql = "SELECT * FROM users WHERE name = :name OR username = :name";
$stmt = $conn->prepare($sql);
When I try this example using pdo_sqlsrv I get the following error:
PDOException: SQLSTATE: [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error
When I use instead the parameters name1 and name2 the query works as expected.
Comment created by @asm89:
Are you sure you were using the 2.2.2 version of the ORM? Can you try to reproduce this with the latest master?
Comment created by @deeky666:
[~jue] ping. I cannot reproduce this error, either. Can you please try to reproduce this with the latest master branch? Otherwise I will close this ticket.
I have the same issue with Doctrine 2.5.4
@Russellmd which driver are you using? pdo_sqlsrv or sqlsrv? Also please give a snippet of the failing code (with exception). I'll investigate then, thanks.
I have tried with both pdo_sqlsrv and sqlsrv for windows 7/8 x64 using:
Symfony + Doctrine
WAMPSERVER 2.5 32/64 bits
Microsoft ODBC Driver 11 for SQL Server
Microsoft Drivers for PHP for SQL Server Version (3.2): php_pdo_sqlsrv_55_ts.dll / php_sqlsrv_55_ts.dll
SQLSTATE: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:119, Doctrine\DBAL\Driver\PDOException(code: 07002): SQLSTATE: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:93, PDOException(code: 07002): SQLSTATE: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:91)"}