Skip to content

Improve SqlBulkCopy truncation error message #256

@Suchiman

Description

@Suchiman

Is your feature request related to a problem? Please describe.

When you try to BulkCopy a too large string, you receive following error from here:

System.InvalidOperationException: String or binary data would be truncated.

This message is "faked" by the managed code to look like the message sql server sends.
A year ago, this message is now available in an improved form, at least if the exception is actually thrown by MSSQL.

Describe the solution you'd like

Please make similiar improvements (column and value affected) to the managed exception.

Describe alternatives you've considered

If you can attach a debugger, you can enable first chance exception breaking for InvalidOperationException, then you'll see the string that was too long when you look in the locals window of the throwing stack frame. But this is only applicable when you can debug it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions