日期:2014-05-17 浏览次数:20414 次
;with t
as
(
select '(xx)1234' v union all
select 'xx1234xyz' v union all
select '1234'
)
select case when patindex('%[^0-9]%',v) = 0
then v
else LEFT(v,patindex('%[^0-9]%',v)-1)
end as v
from
(
select stuff(v,1,patindex('%[0-9]%',v)-1,'') as v
from t
)t