本文共 251 字,大约阅读时间需要 1 分钟。
根据PATINDEX系统函数的引用正则表达式
/*
功能:获取字符串中的数字
*/
create
function
dbo.F_Get_Number (@S
varchar
(100))
returns
int
AS
begin
while PATINDEX(
'%[^0-9]%'
,@S)>0
begin
set
@s=stuff(@s,patindex(
'%[^0-9]%'
,@s),1,
''
)
end
return
cast
(@S
as
int
)
end
--测试
---selec
转载地址:http://aozmi.baihongyu.com/