SQL Server turkish character situation
Solution 1
You can specify a collation in your query such as Turkish_CI_AI
, or alternatively use the 'N' character with your strings to indicate that they are Unicode, as so:
select * from Product where name like N'%GALVANİZ%'
Solution 2
I solved the question myself too. here is the solution
select * from product where name like N'%GALVANi%' collate Turkish_CI_AS
this is a much better solution
Arif YILMAZ
c#, mvc, web api, sql, t-sql, html5, jquery, css, angularjs
Updated on June 09, 2022Comments
-
Arif YILMAZ about 2 years
I am having a Turkish Character problem in ASP.NET and SQL Server. I have searchbox in asp.net and trying to do a search in database. However, I am having problems in Turkish characters. When I search for "GALVANİZ" which contains illegal "İ" character. the word "GALVANİZ" is in the database, I am sure.
When I do a simple select statement in SQL Server tool, it doesn't return anything either.
Here is the SQL
select * from Product where name like '%GALVANİZ%'
This doesn't return anything. How can I get it fixed?
thanks
-
Arif YILMAZ over 11 yearsI will mark it in 5 mins. when I do the select in mssql tool, it works. but when I do it in C# code, it doesnt work. why do you think it doesnt work in c# code
-
Martin over 11 yearsCould you update your original question with the C# code you are using so I could take a look at it? Thanks!
-
Admin almost 3 yearsAs it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.