• john.arnott (4/5/2010)


    This is true for other numeric datatypes as well. Spaces or empty strings are implicitly converted to zero

    DECLARE @MyNum int

    SET @MyNum = ' '

    -- attempt arithmetic operation

    Select @myNum * 4

    -- result is 0, not an error.

    Good point, but I would like it more if SQL Server throws an exception and let developers know upfront that it's wrong to assign string/character values to an integer data type.