I am using table-valued parameters to insert large amounts of data into various tables. When those tables have numeric columns with scale and in a single data table there are rows that have varying numbers of scale I get the following error:
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Table-valued parameter 3 (""), row 0, column 0: Data type 0x6C has an invalid precision or scale
An example of when this happens.
- A table being inserted into and the associated tvp have a numeric(6,3) column
- There are 2 rows in the datatable being inserted
- One has a value of 1.2 for the numeric column
- The other has a value of 1.23 for the numeric column
If the second row in that example has a value of 1.3 for the numeric column there is no error. This is in Java using the jdbc42.jar from the Microsoft JDBC Driver 6.0 for SQL Server with a SQL Server 2016 database.