Subject | check if content string is integer |
---|---|
Author | kittikira |
Post date | 2010-01-22T11:39:07Z |
I need to check the content of a varchar if it is possible to cast as integer.
cast raises an exception, if it the varchar is not compatuble with integer.
In a trigger I want to store the numeric value of a varchar field into an integer field, if the varchar contents anything that is possible to convert. If it is not possible I want the integer field to be set to 0.
Is there a way to do so, without using an udf?
cast raises an exception, if it the varchar is not compatuble with integer.
In a trigger I want to store the numeric value of a varchar field into an integer field, if the varchar contents anything that is possible to convert. If it is not possible I want the integer field to be set to 0.
Is there a way to do so, without using an udf?