insert unicode data to nvarchar column mssql

I have a ploblem with insert unicode data to mssql database

system : centos,freetds

php driver: dblib

table : tbl_test, column : unicol

to insert unicode data in mssql i use ‘N’ prefix with data:

when i try


$command = Yii::$app->db->createCommand("update tbl_test set unicol= 'ชีปหมดทำไงดี' where id = 6");

unicol show in db is ??????

so i use ‘N’


$command = Yii::$app->db->createCommand("update tbl_test set unicol= N'ชีปหมดทำไงดี' where id = 6");

work fine unicol show in db is ชีปหมดทำไงดี.

but i need bind value for this data




    $str = "ชีปหมดทำไงดี";

    $command = Yii::$app->db->createCommand("update tbl_test set unicol= N:str where id = 6");

    $command->bindParam(":str",$str);




get error: SQLSTATE[HY000]: General error: 102 General SQL Server error: Check messages from the SQL Server [102] (severity 15) [(null)]

The SQL being executed was: update tbl_test set unicol= N'ชีปหมดทำไงดี' where id = 6

why?

Anyone help me? Thanks

please tell me why in 2 way with the same sql statement 1 work 1 error :-[

Ploblem is solved.


$str = "ชีปหมดทำไงดี";

    $command = Yii::$app->db->createCommand("update tbl_test set unicol= N? where id = 6");

    $command->bindParam(1,$str);