SQL needs CAST to return values in query

0

Gentlemen, I manage a PHP application that uses SQL Server 2008 database. After a database server migration queries only work by doing the conversion with CAST and selecting one by one in SELECT .

I do not use CAST I get this error.

  Warning: mssql_query (): message: Unicode data in a Unicode-only collation or   ntext data can not 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 \ Site \ test-connection.php on line 152   Warning: mssql_query (): Query failed in C: \ Program Files (x86) \ NetMake \ v81 \ wwwroot \ Site \ test-connection.php   Warning: mssql_fetch_array () expects parameter 1 to be resource, boolean given in C: \ Program Files   (x86) \ NetMake \ v81 \ wwwroot \ Site \ test-connection.php on line 154 *

Does the database server have this outdated ODBC driver?

What can I do to not have to change all of the application's queries?

Below are examples of the 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>";
    }
    
asked by anonymous 21.07.2017 / 17:24

0 answers