Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

String or binary data would be truncated - Determining Which Field ?

Posted on 2009-07-02
4
Medium Priority
?
598 Views
Last Modified: 2012-06-21
During the import of a table with about 80 columns and 1 million rows, I've received the error that "String or binary data would be truncated" ... however, SQL 2005 doesn't tell you which column is being truncated.  

Is there any way to determine this, perhaps more robust error message options, etc.?  A setting somewhere in SQL that will give more details?  Or an error log I'm not aware of that would tell me more information?

I know how to fix the error itself ... my question is about getting more information out of SQL as to what the exact error was.

Thanks


0
Comment
Question by:drgdrg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 24762713
>however, SQL 2005 doesn't tell you which column is being truncated
yes, sadly enough. even worse, if your statement triggered some trigger, and the problem occured there, you could search long time in the table/code without finding the problem...

>Is there any way to determine this, perhaps more robust error message options, etc.?  
not really. double-checking any triggers, and making sure any user input is limited (or cut) at the defined field length, and/or increasing field sizes.
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24762881
I guess there is not short and sweet way of doing so other than just checkout all string column with it's size and comparing it with the data your inserting or updating.
0
 
LVL 14

Assisted Solution

by:Jagdish Devaku
Jagdish Devaku earned 1000 total points
ID: 24762937
hi...
the error clearly says that you are inserting data longer than the solumn size.
if you are aware of the length of the data that you are inserting then you can find the column using the below query.
i think from the event viewer or from sql server logs you can get more info.
bye

select * from information_schema.columns
where character_maximum_length < ?length of the data? and table_name = '?table_name?'

Open in new window

0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24763003
I guess nothing can show you which column is culprit.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question