I came across a weird situation with two instances of SQL Server 2019 running on two different pre-production environments (exactly the same codebase). I'm trying to persist the following Swedish sentence as a nvarchar(200)
:
Förlängd livslängd BFS9
Problem is that when I check one instance of SQL Server 2019, it gets persisted without recognizing those special chars:
When I check the other pre-prod environment SQL Server 2019 instance:
This is causing on the affected pre-prod env a:
Invalid Unicode escape sequence
error obviously.
I've checked for both all available collations by doing a
SELECT * FROM sys.fn_helpcollations();
and they share exactly the same rows (seem also having all the Finnish, Swedish collations, 5508 rows are returned), what can be the problem?
Thank you
CodePudding user response:
Have you checked and compared server, database, table, column, connection collations?
AutoTranslate feature of the SQL Server Native Client ODBC driver?
You can also see what values are stored after cast to varbinary(max)
. I found more than once tons of stupid animals in plain text like this.
CodePudding user response:
Have you tried with nvarchar() COLLATE Finnish_Swedish_CI_AS
?