0

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.

john
  • 1
  • 3

1 Answers1

0

After setting up an integration test and spending an hour or so trying different things I discovered the cause of this was that the values were being inserted as strings to the data table and having the value for a column being zero with multiple trailing zeroes causes this error.

"0" is okay, "0.0" is okay. "0.00" is not. Inserting into the row as numbers fixes it, 0.00 is okay.

john
  • 1
  • 3