Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Iam executing below query but it is giving error statment..

update Tbl_Doc_Stock_Chem_Add_Mst set C_Subarea_Code=i.newcode
,C_Area_Code=sub.C_Area_Code
from Tbl_Doc_Stock_Chem_Add_Mst sd
join indsub i on sd.C_Subarea_Code=i.oldcode
join Tbl_Sub_Area_Mst sub on sub.C_Code=sd.C_Subarea_Code

please tell me as soon as possible..




Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.
Posted
Comments
PIEBALDconsult 16-Jun-15 1:24am    
It means (at least) one of your string values is too long for the column. You'll have to track down which one yourself.
Member 11337367 16-Jun-15 1:49am    
there is no values there like that in the table..
PIEBALDconsult 16-Jun-15 15:36pm    
Of course there aren't; they don't fit.

The error message is pretty explicit: "String or binary data would be truncated"

I'm guessing that you are inserting (or updating) a row in SQL from your application. What is happening is that the data you are trying to insert does not fit in the field: if the data is text, then look at the column definition: you have a defined length of (say) 10 or 50 characters but the data you are trying to insert is longer than that.
Either increase the size of the column, or reduce the size of the data you are sending.
 
Share this answer
 
v2
check your database..
actually this problem may occurring from database
for example

colum_name data_type
---------- ---------
id int
name varchar(8)
address varchar(50)

you insert the value like 1,anand rajan,chennai
id lenght 1
name lenght 10
address length 6

here name length is exceeding because of name datatype length is 8

i hope its may be helps you..

thanks
 
Share this answer
 
Comments
Member 11337367 16-Jun-15 2:00am    
your point is corect in my case both column having minimum size not exceeding the data size value..
This means that your field is not big enough to hold your data.
Check the table, I think you'll find that the length of one or more fields is not big enough to hold the data you are trying to insert.

So you might want to consider the changing the size of it. :)

-KR
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900