• Danny Ocean (3/15/2013)


    Really a nice and good question.

    one more thing apart from this question. if you set ARITHABORT OFF and then execute below code, it will give output as "*" due to insufficient char length. and if you set char length more than 7, it will give "0.111111".

    It denotes that we need to provide an insufficient length whenever we convert values in char or varchar.

    SET ARITHABORT OFF

    select isnull ( convert (char(3),1.0/9) ,'*')

    Vinay, I tried with ARITHABORT OFF but still I am getting same error "Arithmetic overflow error converting numeric to data type varchar."

    set arithabort off

    select ISNULL(CONVERT(char(3),1.0/9),'*')

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/