首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

全角与半角的有关问题

2012-01-30 
全角与半角的问题select*from表wherefd 京03与select*from表wherefd 京03效果一样,我想精确查询,请问如

全角与半角的问题
select   *   from   表   where   fd= '京03 '  

select   *   from   表   where   fd= '京03 '
效果一样,我想精确查询,请问如果区分呢?


[解决办法]
declare @a table( fd Nvarchar(23))
insert @a select '京03 '
insert @a select '京03 '

select * from @a where fd= '京03 ' collate chinese_prc_bin
[解决办法]
select * from 表 where fd= '京03 ' collate Chinese_PRC_CS_AS_WS
select * from 表 where fd= '京03 ' collate Chinese_PRC_CS_AS_WS
[解决办法]
--上面是同统一了的排序规则
--另外还有一个区别是,两种字符的长度是不同的
select datalength( '京03 ' ) --4
select datalength( '京03 ') --6

热点排行