IN SQL Server数据库

栏目: 数据库 · 发布时间: 7年前

内容简介:http://stackoverflow.com/questions/43474596/in-sql-server-database

在我的数据库中我有这个char .我想查询他们

Select * 
from Sometable 
where somecolumn like '%�%'

这让我没有结果.

我认为这是ANSI编码

使用N如下

where col like N'%�%'

why do you think ,you need N prefix

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.

感谢马丁·史密斯,早些时候我只测试了一个字符,它的工作,但正如马丁指出,它返回所有字符..

以下查询工作和返回只有意图

select * from #demo where id  like N'%�%' 
COLLATE Latin1_General_100_BIN

演示:

create table #demo
(
id nvarchar(max)
)

insert into #demo
values
(N'ﬗ'),
( N'�')

要了解更多关于unicode,请看下面的链接

http://kunststube.net/encoding/

https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

http://stackoverflow.com/questions/43474596/in-sql-server-database


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Starfish and the Spider

The Starfish and the Spider

Ori Brafman、Rod A. Beckstrom / Portfolio Hardcover / 2006-10-05 / USD 24.95

Understanding the amazing force that links some of today's most successful companies If you cut off a spider's leg, it's crippled; if you cut off its head, it dies. But if you cut off a st......一起来看看 《The Starfish and the Spider》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具