I have a .NET app that sends a table-valued parameter to a SQL Server stored procedure.
In the SQL Server table, the column is defined as DECIMAL(20,0)
.
Table-valued column on .NET defined as
Columns.Add(new SqlMetaData(name, SqlDbType.Decimal));
When sending a 20 or 19 digit long .net decimal
value like this Convert.ToDecimal(81210694789319013214)
, SQL Server throws an exception:
SqlTruncateException: Numeric arithmetic causes truncation
On a 18 digits long decimal, it works just fine.
There's not much documentation about this error online.
Thanks