Home Forums SQL Server 7,2000 T-SQL what is the difference between CAST and CONVERT Function? RE: what is the difference between CAST and CONVERT Function?

  • Just been testing some data and found this difference between cast and convert.

    When you cast a number to real of size -1.18E-39 you expect an conversion error, so removing a zero should be OK. You have to remove zero's until -1.18E-36 before the error is not thrown.

    Using convert you can use up to -1.18E-38 before the number is changed into a 0 (zero)

    select cast(-0.00000000000000000000000000000000000000118 as real) as [cast result]

    select convert(real, '-0.00000000000000000000000000000000000000118') as [convert result]

    (take away zero's from cast until you get a result)

    Does anyone knows why this is?