How to get if a string is a number in T-SQL

后端 未结 7 1920
一向
一向 2021-01-17 12:57

Is there an easy way to get if string is an integer number (consists only of digits) in MS SQL 2005?

Thank you for your help.

7条回答
  •  心在旅途
    2021-01-17 13:24

    Even though the original poster was referring to SQL 2005, I found in 2008 r2 a straight where isnumeric(string) resulted in an error 4145 non-boolean type. To resolve this use:where isnumeric(string) = 1

提交回复
热议问题