Skip to content
Advertisement

Get nvarchar records that were inserted as varchar

How can I get all values of an NVARCHAR column whose some of the values were accidently inserted without using the N prefix and so was replaced with ?, and then change those values into the correct form?

For example, if I have the following:

Output:

I want to get what was originally 'иытание2' and later turned into gibberish, and fix it.

Advertisement

Answer

You can’t, because it was converted to ? on insertion into the table. The original data is gone. A literal string is created as a VARCHAR unless you prefix it with N.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement