Change from Float to Varchar

  • I got a table imported from Excel by someone with phone number as float so when I select it shows:

    1234567890.0

    Using Cast or Convert will show:

    1.23456e+0

    What can I use to show the number as 1234567890?

    Thanks.

     

     

  • Cast to numeric(10,0)

    SQL = Scarcely Qualifies as a Language

  • OR cast it to int

    select cast( col as int) phone from table


    * Noel

  • thanks.

     

  • A 10-digit phone # could overflow an int, but casting to bigint, dec(10,0), or char(10) would be safe.  STR(phone,10,0) would also work.

Viewing 5 posts - 1 through 4 (of 4 total)

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