一很奇怪的!!!!!!!!!!!!!!!!!!!!!!!希望兄等人下忙
我的中有一表
select * from #t1
DESC1
----------------------------------------
底 不 C-375
外箱 坑 A=B 17-3/8*13-3/4*7-7/8 "
箱 坑 B33 13-1/4*4-1/8*7-1/8 "
外箱 坑 A=B 17-1/8*15-7/8*6-3/8 "
箱 坑 B33 16-5/8*5*5-5/8 "
平咭B3B 12-7/8*3-7/8 "
平咭B3B 6-3/4*3-7/8 "
平咭B3B 16-1/8*4-5/8 "
平咭B3B 4-5/8*5-1/8 "
外箱 坑 A=B 17-3/8*13-3/4*7-7/8 "
(10 row(s) affected)
但是,
select * from #t1 where patindex( '%外箱% ',DESC1) <> 0
很明是有果的,但是
果是:
DESC1
----------------------------------------
(0 row(s) affected)
我了一下
SELECT PATINDEX ( '%外箱% ', '外箱外箱 ')
果:
-----------
1
(1 row(s) affected)
後,我了一,我把desc0 改varchar(1000)
create table #t2
(
desc0 nvarchar(1000) collate Latin1_General_BIN
)
insert into #t2
select '亮C-375 ' union all
select '外箱 坑 A=B 17-3/8*13-3/4*7-7/8 " ' union all
select '箱 坑 B33 13-1/4*4-1/8*7-1/8 " ' union all
select '外箱 坑 A=B 17-1/8*15-7/8*6-3/8 " ' union all
select '箱 坑 B33 16-5/8*5*5-5/8 " ' union all
select '平咭B3B 12-7/8*3-7/8 " ' union all
select '平咭B3B 6-3/4*3-7/8 " ' union all
select '平咭B3B 16-1/8*4-5/8 " ' union all
select '平咭B3B 4-5/8*5-1/8 " ' union all
select '外箱 坑 A=B 17-3/8*13-3/4*7-7/8 " '
select * from #t2
果:
???C-375
?? ?? A=B 17-3/8*13-3/4*7-7/8 "
?? ?? B33 13-1/4*4-1/8*7-1/8 "
?? ?? A=B 17-1/8*15-7/8*6-3/8 "
?? ?? B33 16-5/8*5*5-5/8 "
???B3B 12-7/8*3-7/8 "
???B3B 6-3/4*3-7/8 "
???B3B 16-1/8*4-5/8 "
???B3B 4-5/8*5-1/8 "
?? ?? A=B 17-3/8*13-3/4*7-7/8 "
(10 row(s) affected)
些繁字都成???了
是怎么回事啊,在表#t1中desc0 text 型,我的系也是繁系,sql
英文的
[解决办法]
try
select * from #t1 where patindex(N '%外箱% ',DESC1) <> 0
[解决办法]
看下排序规则是什么,包括本身库的排序规则和tempdb的排序规则
[解决办法]
有奇怪
[解决办法]
create table #t2
(
desc0 nvarchar(1000) collate Latin1_General_BIN
)
insert into #t2
select N '亮C-375 ' union all
select N '外箱 坑 A=B 17-3/8*13-3/4*7-7/8 " ' union all
select N '箱 坑 B33 13-1/4*4-1/8*7-1/8 " ' union all
select N '外箱 坑 A=B 17-1/8*15-7/8*6-3/8 " ' union all
select N '箱 坑 B33 16-5/8*5*5-5/8 " ' union all
select N '平咭B3B 12-7/8*3-7/8 " ' union all
select N '平咭B3B 6-3/4*3-7/8 " ' union all
select N '平咭B3B 16-1/8*4-5/8 " ' union all
select N '平咭B3B 4-5/8*5-1/8 " ' union all
select N '外箱 坑 A=B 17-3/8*13-3/4*7-7/8 " '
select * from #t2
select * from #t2 where patindex(N '%外箱% ',desc0) <> 0
drop table #t2