本文介绍了字符串或二进制数据将在asp.net中被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到的字符串或二进制数据将被截断的时候,我试图执行误差
I'm getting String or binary data would be truncated error when, I'm trying to execute
Insert into Student_info(StudentId,FirstName,LastName,DOB,StudentAddress,StudentEmail,StudentMobile) (Select StudentId,FirstName,LastName,DOB,Address,EmailId,Mobile from Student_temp where StudentId='" & studentid & "')
DDL的语句 Student_Temp
DDL的语句 Student_Info
需要帮助!
推荐答案
此错误是由SQL服务器报告,当你尝试插入字符串或二进制数据转换成一列不具有足够的宽度来保存它,如:
This error is reported by SQL Server when you try and insert string or binary data into a column which doesn't have enough width to hold it, e.g.
create table MyTable
(
Column1 VARCHAR(10)
)
insert into MyTable (Column1) VALUES ('1234567890A')
Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated
在猜测,那是因为你的 Student_info.StudentMobile
是 VARCHAR(10)
,而 Student_temp.Mobile为varchar(50)
这篇关于字符串或二进制数据将在asp.net中被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!