Re: Excel Source [24]] Error: System.Exception: SqlTruncateException: Numeric arithmetic causes

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Anthony Apollis <anthony(dot)apollis(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Excel Source [24]] Error: System.Exception: SqlTruncateException: Numeric arithmetic causes
Date: 2024-02-29 00:12:44
Message-ID: ukrcpvts37hb2oew56d6mtax4p6xwpnugvgzedv4vr7c6vclry@76gy76wybcd5
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2024-02-28 21:22 +0100, Anthony Apollis wrote:
> Please assist. I am using SSIS to read data from an Excel sheet into
> Postgres. I have increased the column size a few times, just cant seem to
> get the data in. Getting errors relating to destination column size.

What is the data type of that column?

> [Excel Source [24]] Error: System.Exception: SqlTruncateException:
> Numeric arithmetic causes truncation.. RowNumber=1, ColumnName=Metric
> Value [DataType=DT_NUMERIC,Length=0], Data=[Length=12,
> Value=311116655.63]
> at ZappySys.PowerPack.Adapter.SqlDataComponentBase.HandleException(Exception
> ex)
> at ZappySys.PowerPack.Adapter.SqlDataComponentBase.PrimeOutput(Int32
> outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
> at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100
> wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers,
> IntPtr ppBufferWirePacket)

Not sure what I'm looking at, but screenshots 1 and 2 say precision=19
and scale=18 which would be numeric(19,18). But value 311116655.63
shown in the error message requires a precision that is at least 9
digits larger than the scale:

regress=# select '311116655.63'::numeric(19,18);
ERROR: numeric field overflow
DETAIL: A field with precision 19, scale 18 must round to an absolute value less than 10^1.
regress=# select '311116655.63'::numeric(27,18);
numeric
------------------------------
311116655.630000000000000000
(1 row)

--
Erik

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guyren Howe 2024-02-29 01:08:00 Content for talk on Postgres Type System at PostgresConf
Previous Message Ron Johnson 2024-02-28 22:39:33 Re: Non-Stored Generated Columns