Thursday, February 16, 2012

Arithmetic overflow error converting float to data type numeric.

HI All,
I have two table, one I am importing data from into the other. The table
that I am importing datafrom is supplied to me, so it is the way it is.
Problem is that the numeric values in the supplied table is floating This
data is used in financial calculations, so I don't think that the floating
type would give me correct financial information.
SO I am importing the data into a table with decimal datatype. Problem is I
keep getting the above error
The data looks something like
48.099968662
I have tried many variations of the deciaml type, including something like
Decimal(12,12). But still the error
What Im I missing here, can some one point me in the right direction
Thanks
Robertselect convert(decimal(11,9),'48.099968662')
decimal(s,p)
s = total number of digits
p = precision (after the dot)
so the first digits should almost always be greater than the second
digit
unless you do something like this
select convert(decimal(9,9),'0.099968662')
Denis the SQL Menace
http://sqlservercode.blogspot.com/
Robert Bravery wrote:
> HI All,
> I have two table, one I am importing data from into the other. The table
> that I am importing datafrom is supplied to me, so it is the way it is.
> Problem is that the numeric values in the supplied table is floating This
> data is used in financial calculations, so I don't think that the floating
> type would give me correct financial information.
> SO I am importing the data into a table with decimal datatype. Problem is
I
> keep getting the above error
> The data looks something like
> 48.099968662
> I have tried many variations of the deciaml type, including something like
> Decimal(12,12). But still the error
> What Im I missing here, can some one point me in the right direction
> Thanks
> Robert

No comments:

Post a Comment