rotem
rotem

Reputation: 113

How to convert to UTF-8 in SQL Server database?

I'm working on MSSQL server 2017.

I got table with a 'name' nvarchar column with values that look like '\u039b \u041e \u0422 \u0422 \u0410'

(sequence of '\u0[number][number][number or letter]')

how do I convert them to the correct characters?

Upvotes: 0

Views: 1234

Answers (1)

Charlieface
Charlieface

Reputation: 72501

This is actually the same as JSON escaping.

You can use JSON_VALUE to get the value out, by creating a JSON array

SELECT JSON_VALUE('["' + t.name + '"]', '$[0]')
FROM YourTable t;

db<>fiddle

Upvotes: 1

Related Questions