SQL Server detects data that is not digital (two methods)
Detection is not a digital type of data, two methods
1. IsNumeric ( expression )
2. PATINDEX ( '%pattern%' , expression )
1. IsNumeric ( expression )
Returns 1 if it is a numeric type, or 0 if not
But IsNumeric is sometimes unreliable, and if you do not allow expression to contain any letters, you will be judged wrong:
Example: IsNumeric (' 23e4 ') returns 1
IsNumeric (' 23d4 ') returns 1
2. PATINDEX ( '%pattern%' , expression )
The return value is the first position that satisfies the pattern, and if not met, the return value is 0
Determine if a number type
PATINDEX ('%[^0-9]% ', expression)
The return value is 0 , it is a purely numeric type
The notation for supporting decimal and positive numbers is
PATINDEX ('%[^0-9|.| -|+]% ', expression)
A number is judged in SQL Server (the. 3 is automatically recognized as 0.3)