Mssql: Show Errors

Hi all,

I have a query to a MSSQL server that fails, but no error message is shown.

All other PHP errors are shown.

Does anyone know how I can display all mssql error messages? Or access the error message from my recent query?

I am using following connection string:

'connectionString' => 'dblib:host=;dbname=mydb;charset=UTF-8',

Here is my code:

$connection = Yii::app()->db;

$sql = "




      dbo.TableXYZ AS bz // Should show a error message, because TableXYZ is not there.


$command = $connection->createCommand($sql);


$rows = $command->queryAll();	



check if connection string is ok

also check the logs file in protected/runtime folder

Thanks KonApaz, my connection string is fine. And my log files only show php errors…

If I change dbo.TableXYZ to a table that exists, results show as expected. Just no error messages when my sql is wrong.

Did you modify an confuguration file of Yii (or sqlserver) ?

In my case the mysql errors displayed.

$connection = Yii::app()->db;

$sql = "SELECT TOP 30 bz.Article_ID FROM dbo.TableXYZ AS bz TableXYZ";

$command = $connection->createCommand($sql);

$rows = $command->queryAll();

check with a tested mysql database if the errors displayed and let me know

MySQL errors are shown. So I guess it’s likely the configuration of the MSSQL server. Any thoughts where I could start looking?

which version of Yii you have?

also check the version of sql server

also check


                        'connectionString' => 'dblib:host=;dbname=mydb;charset=UTF-8',

                         'emulatePrepare' => [color="#FF0000"]false, OR true OR remove this line entirely[/color]

                        'username' => '...',

                        'password' => '...',

                        'charset' => 'utf8',


finaly make your own php code to check if the problem exist on PDO php or your sqlserver