【发布时间】:2018-05-27 00:28:48
【问题描述】:
我只想要给定字符串中的数字十进制其他整数值
当前表输出:
Column
10.40 (10/14 after @ 10.3)
10.1%
10%
10/12/2017 10.45
8.2 10/12
15.20% 10/12/17
11/12
> 10.50
< 50.10
预期输出:
10.40
10.1
10
10.45
8.2
15.20
NULL
NULL
NULL
尝试查询:
declare @strAlphaNumeric VARCHAR(max) ='completed 11/12 at Dr Lemons office'
select
stuff(stuff( @strAlphaNumeric+'x',patindex('%[0-9][^0-9.]%', @strAlphaNumeric+'x') + 1, len( @strAlphaNumeric), '' ), 1, patindex('%[0-9]%', @strAlphaNumeric) - 1,
'')
有人可以帮忙吗?
【问题讨论】:
-
SQL 不是处理这类事情的最佳工具。
标签: sql substring sql-server-2016