Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
"String or binary data would be truncated. The statement has been terminated." Please explain about this exception.
Posted 7-Dec-11 21:09pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This exception occures when your datatype,size does not match with database field attributes.
See Discussion
  Permalink  
Comments
Mehdi Gholam at 8-Dec-11 2:18am
   
5'ed
Uma Shankar Patel at 8-Dec-11 2:30am
   
thanks..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Hi,
Its the error because of data-type and what the size you are passing for inserting data to that field.Suppose i have declared a field named name varchar[20] and i am trying to inserting name of more than 20 characters then i will get an error like "String or binary data would be truncated". So please check all the field.Hope this will work.If not let me know about the error.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

String or binary data would be truncated Error suggests your Datatype in Database is smaller than inserted value.
 

1. Increase datatype length or decrease length of value before inseration.
  Permalink  
Comments
kinjal b patel at 11-Oct-12 8:42am
   
thanks buddy ..........!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

when user store data at that time size of data type is less as compared to required data type size then it gives such kind of error solution to increase your data type size...
  Permalink  
Comments
ThePhantomUpvoter at 3-Mar-13 11:50am
   
Exactly what the other solutions told him in Dec 2011. How does your solution in any way provide any additional information on this question?
bramh1234 at 28-Apr-13 13:37pm
   
how i can handle this exception String or binary data would be truncated.\r\nThe statement has been terminated."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 11 Mar 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100