T-sql - determine if value is integer

后端 未结 20 2165
情深已故
情深已故 2020-11-30 12:11

I want to determine if a value is integer (like TryParse in .NET). Unfortunatelly ISNUMERIC does not fit me because I want to parse only integers a

相关标签:
20条回答
  • 2020-11-30 12:59

    Case
    When (LNSEQNBR / 16384)%1 = 0 then 1 else 0 end

    0 讨论(0)
  • 2020-11-30 13:00

    Use PATINDEX

    DECLARE @input VARCHAR(10)='102030.40'
    SELECT PATINDEX('%[^0-9]%',RTRIM(LTRIM(@input))) AS IsNumber
    

    reference http://www.intellectsql.com/post-how-to-check-if-the-input-is-numeric/

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