msSql_函数_从字符串取出数字[zt]
时间:2007-05-14 来源:davidxueer
Create FUNCTION fn_numeric(@s varchar(2000))
RETURNS varchar(200)
AS
BEGIN
DECLARE @r varchar(200)
SET @r =''
WHILE PATINDEX('%[0-9|.]%',@s)>0
BEGIN
SET @r = @r + SubString(@s, PATINDEX('%[0-9|.]%', @s), 1)
SET @s = Stuff(@s, 1, PATINDEX('%[0-9|.]%', @s), '')
end
RETURN @r
--调用 select dbo.fn_num('a2h5我j.8 ') 结果 25.8
END
相关阅读 更多 +