I have DB which is working with Russian text however when i run queries it shows me this. Database will used by Russians and it has to show Russian text properly!
While Aaron Bertrand gave a good explanation why do you getting such a results, I'd say there's a way not to prefix all you strings with russian letters with 'N'
.
As far as I know, you have just set your server collation properly. So if you set your collation, for example, like Cyrillic_General_CI_AS
, server could treat varchar with russian letters properly:
select
'español', '平成年月日', 'иван',
serverproperty('collation')
results:
espanol ????? иван Cyrillic_General_CI_AS
As you see, spanish and Chinese strings are not treated properly while russian strings are. So you can insert data into nvarchar columns without prefixing strings with 'N'
That said, I'm using nvarchar data type in our database as default strings, nvarchar parameters in stored procedures. I very rarely use russian strings in code (only when I want to test something), and I've never used N'string'
syntax.
While having correct default collation could be handy, there's problem with this solution - it's not easy to change default collation on installed SQL Server, so you have to be careful when installing SQL Server instance and choose collation properly.