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

后端 未结 7 1916
一向
一向 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

    0 讨论(0)
提交回复
热议问题