4

Using SQL Server 2005

I have two table which have the same datatype and datasize, same data's

When i execute my query, I got the result in one table, when i execute the another table i got this error as string or binary data would be truncated error, i checked the datatype size also. Before it was running, am getting this error from two days onwards.

I checked the datatype size also, i modified my datatype upto 256, still it showing error.

How to solve this issue.

1
  • Can you tell us what type and size the column has, and the maximum size of data you can insert before it fails? Try smaller and smaller sizes until you get success. Commented Jan 9, 2010 at 13:12

5 Answers 5

2

You have to check everything is the same...

  • Correct DB?
  • Correct schema? (eg foo.MyTable and dbo.MyTable)
  • Correct column order?
  • Trigger?
  • Concatenation or some processing?
  • Same data being inserted?

Edit: What was it of my list, out of interest please?

Sign up to request clarification or add additional context in comments.

Comments

2

Perhaps it is a different field then the one you suspect.

Comments

2

If you are absolutely sure that there are no offending data values that are inserted into the table, then it must be a trigger. Check your triggers and you will find the offending data points there, which perhaps inserts into an completely unrelated table.

Unfortunately, the sql server error message has been the same since I know of the product (about 15 years). A better error message that shows at least the offended table name and column is among the feature requests for some time. No response from microsoft yet

K.

Comments

1

Things I would check:

If the fields size are the same, check for field sequence, i.e.

table1:   Address,City,State,ZipCode
table2:   Address,City,ZipCode,State

Inserting into table 1 from table two would cause the error.

Another possibility is the query might do some sort of concatenation

Comments

1

If the fields are all matched, then is there a trigger on the table that is also involving an additional table which has a column defined that is too short?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.