Daxesh Radadiya
Daxesh Radadiya

Reputation: 73

How can I print this in sql server?

The output window is filled with '?' marks.

select ('все магазины Сильпо') as test

I want the exact same text in the output window. I am using SQL Server 2016.

Upvotes: 0

Views: 184

Answers (2)

Yogesh Sharma
Yogesh Sharma

Reputation: 50173

Add N prefix to identify unicode character :

SELECT N'все магазины Сильпо' AS test

N actually stands for National language character set.

To quote from Microsoft:

Prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters.

Upvotes: 8

Thom A
Thom A

Reputation: 95830

You need to define your string literal as a nvarchar, not a varchar:

PRINT N'все магазины Сильпо';

Upvotes: 5

Related Questions