CREATE FUNCTION dbo.IsReallyNumeric(@AStr VARCHAR(64)) RETURNS BIT AS  
BEGIN  
  IF LEFT(@AStr, 1) = '-'  
    SET @AStr = SUBSTRING(@AStr, 2, LEN(@AStr))  
 
  DECLARE @pos INT  
 
  SET @pos = 1 + LEN(@AStr) - CHARINDEX('.', REVERSE(@AStr))  
 
  RETURN CASE WHEN PATINDEX('%[^0-9.-]%', @AStr) = 0 
    AND CHARINDEX('.', @AStr) = 0
    AND CHARINDEX('-', @AStr) = 0
    AND CHARINDEX('+', @AStr) = 0
    AND CHARINDEX('^', @AStr) = 0
    AND LEN(@AStr)>0
    AND @AStr NOT LIKE '%-%'
    AND (((@pos = LEN(@AStr)+1) OR @pos = CHARINDEX('.', @AStr)))
    AND CAST(@AStr AS NUMERIC(38, 0)) BETWEEN -2147483648. AND 2147483647. THEN
    1  
  ELSE  
    0  
  END  
END