úterý 12. října 2010

IsNumeric is not numeric (MS SQL)

Run this on MS SQL (2008 RC2, but I don't think the version matters):


select isnumeric('.')
select convert(int,'.')

Sweet isn't it? And no, it's not because integers are not supposed to have a decimal dot.

select convert(float,'.')

explodes too. 
Let's continue the fun.

select isnumeric('-')

returns 1.

select convert(int,'-')

returns 0 and

select convert(float,'-')

explodes. Why???

On the other hand

select convert(int, '14.878')

explodes, while

select convert(int, convert(float,'14.878'))

returns 14.

Žádné komentáře:

Okomentovat