diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index f3ffc3976..bef12f054 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -2496,6 +2496,12 @@ void sqlsrv_param::bind_param(_Inout_ sqlsrv_stmt* stmt) { if (was_null) { strlen_or_indptr = SQL_NULL_DATA; + if ((sql_data_type == SQL_CHAR) && (column_size == 1)) { + // This is a work-around for a bug in Microsoft SQL Server and/or unixODBC and/or msodbcsql; + // as to how the T-SQL operator ISNULL likes to see a NULL. + sql_data_type = SQL_VARCHAR; + column_size = 0; + } } core::SQLBindParameter(stmt, param_pos + 1, direction, c_data_type, sql_data_type, column_size, decimal_digits, buffer, buffer_length, &strlen_or_indptr);