Convert Float to a Phone Number

  • Hello Everyone

    I seem to always get the "Fun Stuff" to try and figure out. I have an entire table that was pumped out of Oracle. I even hate saying that word! LOL

    There are a couple columns that are Float data type, and they are storing phone numbers as a Float data type. I am not able to CAST these into anything that is legible. Does anyone know of a way? Do you happen to know how?

    This is one of the values that I made up that look like some of the others.

    9.72732e+009

    Thank you in advance, I greatly appreciate all your assistance, suggestions and comments on this.

    Andrew SQLDBA

  • I doubt you'll be able to recover the full number. Floats are imprecise beyond their guaranteed number of digits. You'll likely have to re-export the data.

    That said, you could try changing the column type to decimal, letting SQL do the conversion for you, then test the results:

    ALTER TABLE ... ALTER COLUMN ... decimal(18, 0)

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Thank You Scott

    That is exactly what I thought as well. Nothing I can do about that. I looked at the original data.

    Thank You for your assistance and suggestion

    Andrew SQLDBA

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

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