主要是在sql server的内置系统函数ISNUMERIC的基础上,将例外的“+”、“-”、“$”等也进行判断。

CREATE FUNCTION [dbo].[fn_IsNumberic]
(
@str nvarchar(max)
)
RETURNS int
AS
BEGIN
declare @res int
set @res=case when ISNUMERIC(isnull(@str,0))=1 then
case when PATINDEX('%[^0-9.]%',rtrim(ltrim(isnull(@str,0))))=0 then 1
end
end
return isnull(@res,0)
END

GO

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案