SQLTeam.com | Weblogs | Forums

Field that is a float, null - Need to change it


#1

I am trying to insert my data into a table that I am creating, but I am getting values that that look like this 1.31692e+009. Not sure how to fix that. I am trying to place them into a table that the field type is varchar.

Any help would be great, thanks!


#2
SELECT CAST(CAST(1.31692e+009 AS int) AS varchar(15))

#3

Where are you sourcing the data from? Usually you see this when trying to import data from an Excel file. Excel tries to be helpful and presents cells that it thinks contains numbers as numbers, and if they are large presents them in scientific notation. If that is the case, you can change it by selecting the columns in question in Excel, right-click and select format cells, and select custom, and select 0 for type.

Of course, you didn't say where you are sourcing the data from, so I get the distinct feeling that I am barking up the wrong tree.