There is no boolean in SQL Server. This means that you cannot just say IF (expression) ; you have to compare it with something because it returns true or false in the same sense as you are probably used to in other languages.
Just a preference, but I would rather write it like this:
IF ISNUMERIC('5675754674') = 1 BEGIN ... END
There is no way in SQL Server to avoid comparing with 1, as in your second example.
In addition, you should be aware of the weaknesses of ISNUMERIC() - it can give false positives for "numerical" values, such as . , CHAR(9) , e , $ and many other non-numeric strings. If you want to know if there is something integer, for example, it is better to say:
IF '5675754674' NOT LIKE '%[^0-9]%' BEGIN ... END
But even this is not a complete and reliable test, because it will return true for values > (2^32)-1 and will return false for negative values.
Another drawback of ISNUMERIC() is that it will return true if the value can be converted to any of the numeric types, which does not match all numeric types. Often people test ISNUMERIC() and then try to apply FLOAT to SMALLINT , and the conversion fails.
In SQL Server 2012, you will have a new TRY_CONVERT() method that returns NULL if the conversion to the specified data type is invalid.
Aaron bertrand
source share