Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String or binary data would be truncated.\r\nThe statement has been terminated. while xml insertion

Tags:

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

like image 218
user208466 Avatar asked Apr 04 '11 06:04

user208466


2 Answers

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

like image 173
ysrb Avatar answered Sep 16 '22 22:09

ysrb


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      . 
like image 25
sudhAnsu63 Avatar answered Sep 17 '22 22:09

sudhAnsu63