I have bulk-data in SQL-Server table. One of the fields contains following data :
我在SQL-Server表中有批量数据。其中一个字段包含以下数据:
'(اے انسان!) کیا تو نہیں جانتا)'
Tried:
SELECT * from Ayyat where Data like '%انسان%' ;
but it is showing no-result.
但它显示没有结果。
2 个解决方案
#1
7
Plese use N before string if language is not a english:
如果语言不是英语,请在字符串前使用N:
SELECT * from Ayyat where Data like N'%انسان%' ;
#2
1
If you're storing urdu, arabic or other language except english in your database first you should convert your database into another format and then also table.
如果您在数据库中存储除英语之外的urdu,阿拉伯语或其他语言,则应首先将数据库转换为另一种格式,然后再转换为表格。
first you've to convert your database charset and also collation alter your database
首先,您要转换数据库字符集,还要整理数据库
ALTER DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci
then convert your table
然后转换你的表
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
after this execute normal your query
在此之后执行正常的查询
SELECT * FROM table_name WHERE Datas LIKE '%انسان%'
Note: if you not convert your database and table other languages and special characters will be changed into question marks.
注意:如果您没有转换您的数据库和表,其他语言和特殊字符将被更改为问号。
#1
7
Plese use N before string if language is not a english:
如果语言不是英语,请在字符串前使用N:
SELECT * from Ayyat where Data like N'%انسان%' ;
#2
1
If you're storing urdu, arabic or other language except english in your database first you should convert your database into another format and then also table.
如果您在数据库中存储除英语之外的urdu,阿拉伯语或其他语言,则应首先将数据库转换为另一种格式,然后再转换为表格。
first you've to convert your database charset and also collation alter your database
首先,您要转换数据库字符集,还要整理数据库
ALTER DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci
then convert your table
然后转换你的表
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
after this execute normal your query
在此之后执行正常的查询
SELECT * FROM table_name WHERE Datas LIKE '%انسان%'
Note: if you not convert your database and table other languages and special characters will be changed into question marks.
注意:如果您没有转换您的数据库和表,其他语言和特殊字符将被更改为问号。