-1

我有这个 varchar 字段;

Substrg
--------
38-40week
8month
7
40
38-40week

我只想获取数字,例如:

38-40
8
7
40
38-40

我试过这个,但它不起作用......:

select SUBSTRING(Substrg, PATINDEX('%[0-9]%', Substrg), LEN(Substrg))

我能怎么做?谢谢

4

1 回答 1

3
select  replace ('38-40week', SUBSTRING('38-40week', PATINDEX('%[a-z]%', '38-40week'), 
LEN('38-40week')),'')
于 2014-09-24T11:15:08.173 回答