T-sql - determine if value is integer

后端 未结 20 2205
情深已故
情深已故 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:46

    I think that there is something wrong with your database design. I think it is a really bad idea to mix varchar and numbers in one column? What is the reason for that?

    Of course you can check if there are any chars other than [0-9], but imagine you have a 1m rows in table and your are checking every row. I think it won't work well.

    Anyway if you really want to do it I suggest doing it on the client side.

提交回复
热议问题