Converting a varchar to real??

  • Hi,

    in an SQL statement, I should convert a varchar (e.g. '23.467') to real.

    But neither the statement 'CAST(myVarchar as real)' nor CONVERT(real, myVarchar) works.

    Does anybody has an idea, how I can convert a varchar to a real?

    thanks and regards

     

    Fredy

  • This works...

    declare @ch varchar(10)

    set @ch = '23.467'

    select convert(real, @ch)

     



    Shamless self promotion - read my blog http://sirsql.net

  • as does:

    declare @ch varchar(10)

    set @ch = '23.467'

    select cast(@ch as real)

    cheers

    dbgeezer

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply