Throw sqlserver exception when col value for tvp is invalid.
@@ -4750,6 +4750,7 @@ final class TDSWriter {
// Handle conversions as done in other types.
isShortValue = columnPair.getValue().precision <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
isNull = (null == currentObject);
+ try {
if (currentObject instanceof String)
dataLength = isNull ? 0 : (toByteArray(currentObject.toString())).length;
else
@@ -4789,6 +4790,10 @@ final class TDSWriter {
writeBytes((byte[]) currentObject);
}
}
+ }
+ catch (IllegalArgumentException e) {
+ throw new SQLServerException(SQLServerException.getErrString("R_TVPInvalidColumnValue"), e);
+ }
break;
default:
