SQL IsNumeric not working

前端 未结 11 858
迷失自我
迷失自我 2021-01-02 19:47

The reserve column is a varchar, to perform sums on it I want to cast it to a deciaml. But the SQL below gives me an error

select
cast(Reserve as decimal)
fr         


        
11条回答
  •  耶瑟儿~
    2021-01-02 20:04

    It seems that isnumeric has some Problems:

    http://www.sqlhacks.com/Retrieve/Isnumeric-problems (via internet archive)

    According to that Link you can solve it like that:

    select
    cast(Reserve as decimal)
    from MyReserves
    where MyReserves is not null
    and MyReserves * 1 = MyReserves 
    

提交回复
热议问题