字符串或二进制数据将在asp.net中截断

时间:2023-01-14 15:42:19

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 & "')

Table structure of Student_Temp

Student_Temp的表结构

字符串或二进制数据将在asp.net中截断

Table structure of Student_Info

Student_Info的表结构

字符串或二进制数据将在asp.net中截断

Need Help !!

需要帮忙 !!

1 个解决方案

#1


3  

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.

当您尝试将字符串或二进制数据插入到没有足够宽度来容纳它的列时,SQL Server会报告此错误,例如,

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

At a guess, it is because your Student_info.StudentMobile is varchar(10) whereas Student_temp.Mobile is varchar(50)

猜测,这是因为您的Student_info.StudentMobile是varchar(10)而Student_temp.Mobile是varchar(50)

#1


3  

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.

当您尝试将字符串或二进制数据插入到没有足够宽度来容纳它的列时,SQL Server会报告此错误,例如,

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

At a guess, it is because your Student_info.StudentMobile is varchar(10) whereas Student_temp.Mobile is varchar(50)

猜测,这是因为您的Student_info.StudentMobile是varchar(10)而Student_temp.Mobile是varchar(50)