21

Can you please let me know how do I resolve this problem while inserting xml data into Sql Server 2008

ex = {"String or binary data would be truncated.\r\nThe statement has been terminated."}

I already replaced ', "" with an empty string

thanks in Advance

3 Answers 3

26

Please check the datetype of the column. Make sure it has enough space.

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

1 Comment

How to know which column is causing the problem
20

Check the Database Column Size and Data length. you will get this error when you are storing data of length greater than that of defined size.

    Ex. string Data = "saving this data causes error.";
    int datalength = Data.Length;  // will be 30 characters , greater than defined size

    Customer.Name = Data;
    //you will get error for this line if you have Name (varchar 25, null) in db      .

Comments

1

If you're using a subquery change the = between the sub query and main query to in.

It may be that you have more than one field for each record of the main query.

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.