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

有帮助吗?

解决方案

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%'

其他提示

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

sudo systemctl stop mssql-server sudo /opt/mssql/bin/mssql-conf set-collation enter collation: Turkish_CI_AS sudo systemctl start mssql-server

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top