Page 1 of 1

Auto prefix 'N' for unicode string literals?

Posted: Fri 21 May 2010 16:19
by GMG
We have a lot of code we have to make compatible with SQL Server Unicode, and prefixing all string literals with 'N' is one of the required changes.

Is this by any chance something the can be done behind the scenes by the DevArt drivers, say, using a connection parameter?

I don't see any in the documentation, but I thought it would be worth a check.

Thanks very much!

Posted: Tue 25 May 2010 12:31
by Dimon
DbxSda supports Unicode. To use Unicode you should set the proper parameter of TCRSQLConnection to True, like this:
TCRSQLConnection.Params.Add('UseUnicode=True');

Posted: Fri 28 May 2010 04:42
by GMG
Thanks. I had this in the initialization, and unicode parameters work fine, but SQL without parameters like this do not:

update table set col='CHINESE TEXT'

-- select shows '?????????'

update table set col = N'CHINESE TEXT'

-- select shows 'CHINESE TEXT'

So, we have to update our SQL to add the N.

Correct?

Thanks again for the help.

Posted: Fri 28 May 2010 11:09
by Dimon
Yes, it is right.