为什么错误:字符串或二进制数据将被截断 [英] why error :String or binary data would be truncated

查看:76
本文介绍了为什么错误:字符串或二进制数据将被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写
插入db1.dbo.table(f1)
选择f1
来自db2.dbo.table2
让我出错

i write
insert into db1.dbo.table (f1)
select f1
from db2.dbo.table2
get me error

Msg 8152, Level 16, State 13, Line 1
String or binary data would be truncated.




为什么?




why?

推荐答案

这是因为table2的字段"f1"的类型大于第一个表的"f1".
例如,您要在"char(9)"字段中插入类型为"char(10)"的值.
That is because the type of the field "f1" of table2 is bigger than the "f1" of the first table.
For example you are inserting a value of type "char(10)" into a field of "char(9)" .


请参见讨论 ^ ]


1]请检查两个表中的数据类型是否为var binary或var char都必须为varchar或varbinary第一件事.

2]请检查两个表中varchar的范围,它们必须相同,并且如果要通过storeprocedure执行命令,则还要在存储过程中检查相同的值.
1]please check the data type in both table''s whether it is var binary or var char both must be varchar or varbinary first thing.

2]please check the range of varchar in both tables they must be same and if you are executing the command through storeprocedure then check the same in store procedure as well.


这篇关于为什么错误:字符串或二进制数据将被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆