0
Gentlemen I manage an application PHP which uses SQL Server 2008 database. After a server migration from the database queries only work by converting with CAST and selecting one by one on SELECT.
When nay use the CAST get this error.
Warning: mssql_query(): message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (Severity 16) in C: Program Files (x86) Netmake V81 wwwroot.php test-connected online site 152 Warning: mssql_query(): Query failed in C: Program Files (x86) Netmake V81 wwwroot Site test-connected.php on line 152 Warning: mssql_fetch_array() expects Parameter 1 to be Resource, Boolean Given in C: Program Files (x86) Netmake V81 wwwroot Site test-connected.php on line 154*
Does the Database server have this outdated ODBC driver?
What I can do to not have to change all the application queries?
Below examples of codes:
## Não funciona (Consultas Autuais)
$sql="SELECT * FROM MinhaTabela";
$resultado = mssql_query($sql);
while ($row = mssql_fetch_array($resultado)) {
echo$row['CampoVarchar']."<br>";
}
## Funciona
$sql="SELECT CampoVarchar , CAST(CampoVarchar AS TEXT) AS CampoVarchar FROM MinhaTabela";
$resultado = mssql_query($sql);
while ($row = mssql_fetch_array($resultado)) {
echo$row['CampoVarchar']."<br>";
}
The driver
mssql_
is old if assemble a simple code with the functionssqlsrv_
has the same problem?– rray
Opa rray, I’ll try here !
– denis
It worked, I switched the connection that was mssql_connect and it worked. I will take some trouble to change the drivers more will be much less evasive than fiddling with queries and so I already get rid of that obsolete driver, thank you @rray
– denis