日期:2014-05-18  浏览次数:20450 次

这个条件怎么写?
如果表a中的  

字段p(字符型)  
               
A-769954
1-978663
.....类似

的第一位是数字则选出来

select   *   from   a   where   ?????????

如果直接用substring会类型错误哦。。。

------解决方案--------------------
select * from tablename where left(p,1) in ( '0 ', '1 ', '2 ', '3 ', '4 ', '5 ', '6 ', '7 ', '8 ', '9 ')
------解决方案--------------------
create table #temp
(aa varchar(50))

insert into #temp
select 'A-1234 '
union all
select 'B-1234 '
union all
select '2-1234 '
union all
select '3-1234 '

select * from #temp where left(aa,1) between '0 ' and '9 '

-----
aa

2-1234
3-1234

------解决方案--------------------
where isnumeric(left(p,1))=1