SSMS – Using Unicode Fonts in Grid Results

ssms

I wrote this simple update query:

update foo set test ='褠ఓ�ᵂ뱗텬㰗' where id = 1

[test] is an nvarchar(16) column. It's going to contain an encrypted value.

In SSMS (10.50) I've set the font for grid results and text results to Lucida Sans Unicode. The glyphs (褠ఓ�ᵂ뱗텬㰗) are displayed in the query editor window. But the grid results and text results windows always show simply question marks '????????" instead of 褠ఓ�ᵂ뱗텬㰗.

I closed and opened SSMS after making the font changes in Tools ->Options.

Any suggestions would be appreciated. I normally won't need to make any sense of the contents of this column, but when testing to make sure the client app is sending through the correct data, it would be helpful to see something other than question marks.

Best Answer

If you want to insert Unicode text in your update statement you need to supply a Unicode string of the form N'...', as in

update foo set test = N'褠ఓ�ᵂ뱗텬㰗' where id = 1

Otherwise the characters really are converted to question marks if SQL Server is unable to map them to corresponding non-Unicode characters, even in an nvarchar column.