Link to home
Start Free TrialLog in
Avatar of tmajor99
tmajor99

asked on

MS SQL to detect number values plus decimals. Whole numbers and numbers with decimals only.

Need help with MS SQL statement that will check for numbers values including decimals.  Will isnumeric work for this purpose?  


Value

---------- 

100.99        Good 

$2.0             Bad 

1                  Good 

500             Good 

ABC             Bad 

000.4000      Good 

10.999999    Good

6.                    Good

-400               Bad

3/4                  Bad 

1.56 ABC       Bad 

Avatar of ste5an
ste5an
Flag of Germany image

Same again, store NUMERIC() values,

For your question, there is a common accepted modus operandi: It's called testing. But you should look instead of ISNUMERIC() into TRY_PARSE() and TRY_CAST().

And about your sample data: Why is ABC 'bad'`? It is a valid hexadecimal value.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial