34,588
社区成员
发帖
与我相关
我的任务
分享
select *
from tb
where
left(货号,charindex('-',货号)-1)+ltrim(cast(right(货号,len(货号)-charindex('-',货号)) as int))='32915762'
declare @s varchar(10)
set @s='32915762'
select *
from tb
where replace(replace(货号,'-',''),'0','')=@s
--楼主的SQL语句是什么?没有使用模糊查询吧!
like '%32915762%'
select * from tb where 货号 like '32915%762%'
where 货号 like '%32915-000000762%'
declare @t table(f1 varchar(15))
insert @t
select '32915-000000762' union all
select '32915-000000763' union all
select '32915-000000764' union all
select '32915-000000765'
declare @str varchar(15)
set @Str='32915762'
set @str=left(@Str,5)+'-'+right('000000000'+substring(@Str,6,15),9)
print @Str
select *
from @t
where f1=@str
where 货号 like '32915%762'
where 货号 like '32915%762%'