Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 String or binary data would be truncated.

Author  Topic 

df5
Starting Member

2 Posts

Posted - 2010-04-22 : 11:28:19
Hello,

I have two varchar(max) fields in a table and when trying to do an update/insert or update to this table I receive the following error message, "String or binary data would be truncated." I would imagine that it's one of the two varchar(max) fields that causing this to occur. I am storing large amounts of text data, thus the reason using varchar(max) field. If varchar(max) stores up 2^31-1 bytes (characters), how is this happening (I doubt that 2 gigs worth of text is being entered).

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-22 : 11:46:44
I can imagine that the error occurs on smaller columns in your table.
Maybe you have tried to insert a value with 300 characters into a column with format of varchar(255).
In my experience this error occurs if the destination column is smaller than the source data or source column.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

df5
Starting Member

2 Posts

Posted - 2010-04-22 : 13:33:56
Actually I do have a smaller varchar column in the table that allows less than what's allocated in the update/insert procs for this table. Thanks for the insight.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-22 : 14:57:41
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -