Any clever way to fix 'string or binary data would be truncated' warning with LINQ
Posted
by Simon_Weaver
on Stack Overflow
See other posts from Stack Overflow
or by Simon_Weaver
Published on 2008-11-20T19:02:41Z
Indexed on
2010/06/13
5:12 UTC
Read the original article
Hit count: 314
sql-server
|truncated
Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ.
I've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to find the culprit in a batch of rows.
Am I missing something or in this day and age do I really have to still use a brute force method to find the problem.
Please dont give me advice on avoiding this error in future (unless its something much cleverer than 'validate your data'). The source data is coming from a different system where I dont have full control anyway - plus I want to be lazy.
PS. Does SQL Server 2008 actually tell me the field name. Please tell me it does! I'll upgrade!
© Stack Overflow or respective owner