Home Forums SQL Server 2008 T-SQL (SS2K8) 0 is equal to zero length string. Can someone explain how this can be? RE: 0 is equal to zero length string. Can someone explain how this can be?

  • Oracle converts an empty string to null. If I could choose how SQL Server handled it, my 1st preference would be a type conversion error. 2nd would be the way Oracle does it, but to say '' = 0 is just not right.

    SQL Server Query

    select cast('' as int)

    -----------

    0

    Oracle Query

    SELECT TO_NUMBER('') FROM dual;

    ----------

    (null)