Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
CREATE function fn_numeric
-- input is varchar string.
(@string varchar(12) )
returns bit -- 0 = false, 1 = true
as
begin
declare @x smallint, @y smallint, @z bit
set @string = replace(@string, ' ', '@')
set @x = len(@string)
set @y = 0
set @z = 1
while @y < @x
begin
set @y = @y + 1
if substring(@string, @y, 1) between '0' and '9'
continue
else
begin
set @z = 0
break
end
end
return (@z)
end
WHERE
ColumnToTest NOT LIKE '%[^0-9.-]%'
AND ColumnToTest NOT LIKE '%.%.%'
AND ColumnToTest NOT LIKE '%-%-%'
AND (
ColumnToTest LIKE '-%'
OR ColumnToTest NOT LIKE '%-%'
)
AND (
ColumnToTest LIKE '%[0-9].[0-9]%'
OR ColumnToTest NOT LIKE '%.%'
)