Test numeric value !!

Test numeric value !!

Post by Christian FODE » Wed, 01 Jun 1994 00:39:11



I have a table with a character column and I want to test (trigger) before
insert if the value is only numeric or no ...

Thanks for reply


 
 
 

Test numeric value !!

Post by Mark Seid » Wed, 01 Jun 1994 07:42:35



>I have a table with a character column and I want to test (trigger) before
>insert if the value is only numeric or no ...

yes, sql really sucks for this sort of thing since the
regular expressions are so poor.  nothing like [0-9]*, alas.

unfortunately trying to compare with string constants containing
integer values doesn't work since "0123" != "123", and there's no
implicit conversion.  phooey.  

i suppose you could
select convert(numericaltype, column)

in fact, just doing this and rolling back in the event of an error
works for many triggers.