Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not truncate given value in exception message for BulkLoadCannotConvertValue #960

Conversation

Berreek
Copy link

@Berreek Berreek commented Mar 4, 2021

It was introduced in #437 - for some reason the given value is getting truncated when it is longer than 100 chars - I looked trough PR comments and didn't see anything why it is like this. The exception message together with inner exception is really missleading when column is bigger than 100 chars and given value is bigger than column size. It looks like this:

Exception message:

The given value 'https://something.com/5e6109fb8ca1de00010b2446/documents/3d47b19d-c469-4c36-a3f4-edda' of type String from the data source cannot be converted to type nvarchar for Column 8 [Url] Row 1.

Inner exception message:

String or binary data would be truncated in table '[Something].[File]', column 'Url'. Truncated value: 'https://something.com/5e6109fb8ca1de00010b2446/documents/3d47b19d-c469-4c36-a3f4-edda

@dnfadmin
Copy link

dnfadmin commented Mar 4, 2021

CLA assistant check
All CLA requirements met.

@Wraith2
Copy link
Contributor

Wraith2 commented Mar 4, 2021

The non-truncated value could be anything up to ~2Gib in size and I don't think many people would appreciate that appearing in their exception logs. Is there something that can be known from the full value that can't be from the first 100 chars or so?

@David-Engel
Copy link
Contributor

As Wraith2 said, it was definitely truncated on purpose and we don't want to return the full value. But perhaps we can indicate that by appending "..." to the truncated value?

quotedValue = string.Format(" '{0}'", (value.Length > 100 ? value.Substring(0, 100) + "..." : value));

@Berreek
Copy link
Author

Berreek commented Mar 5, 2021

Is there something that can be known from the full value that can't be from the first 100 chars or so?

In my case I had url which had query params that I did not expect to have when I was setting up column size.

But perhaps we can indicate that by appending "..." to the truncated value?

I like this idea and get your point about about the size of non-truncated value. But except this could we also add atleast the length of given value? In most cases I guess you would like to know by how much limit is exceeded.

Base automatically changed from master to main March 15, 2021 17:54
@cheenamalhotra
Copy link
Member

@Berreek

I like this idea and get your point about about the size of non-truncated value. But except this could we also add atleast the length of given value? In most cases I guess you would like to know by how much limit is exceeded.

Could you append the actual length to the message instead of full value keeping current message as-is and re-prepare the PR for review?

@JRahnama
Copy link
Contributor

Not planed.

@JRahnama JRahnama closed this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants