selvakumar
selvakumar

Reputation: 1791

other language word inside sql like query not working?

the following sql query

SELECT [name] ,[mail]  FROM [UserTable]  WHERE  name LIKE '%test%'

is working. but

SELECT [name] ,[mail]  FROM [UserTable]  WHERE  name LIKE '%pārbaude%'

is not working (does not return corresponding row even its available). the difference is the word inside % (pārbaude) other language(Latvian) word.

But when i execute

SELECT [name] ,[mail]  FROM [UserTable] 

is coming. How can i achieve with where condition?

Upvotes: 0

Views: 903

Answers (3)

Eric
Eric

Reputation: 5743

If your column is nchar / nvarchar, use N to represent unicode

SELECT [name] ,[mail]  FROM [UserTable]  
WHERE  name LIKE N'%pārbaude%'

Upvotes: 2

Deepshikha
Deepshikha

Reputation: 10284

SELECT [name] ,[mail]  FROM [UserTable]  
WHERE  name LIKE '%pārbaude%'
COLLATE SQL_Latin1_General_CP1_CI_AS;

Upvotes: 0

void
void

Reputation: 7890

if the type of name column is not nvarchar try with changing it to nvarchar, unless you have to pass the characters with the same codepage in your db

Upvotes: 1

Related Questions