为什么不“截断字符串或二进制数据"?更具描述性的错误?
开始:我了解此错误的含义 - 我没有尝试解决它的实例.
众所周知,此错误很难解决,因为如果您将一百万行插入到 100 列宽的表中,则几乎无法确定导致错误的行的哪一列 - 您必须修改您的流程以一次插入一行,然后查看哪一行失败.委婉地说,那是一种痛苦.
This error is notoriously difficult to troubleshoot, because if you get it inserting a million rows into a table 100 columns wide, there's virtually no way to determine what column of what row is causing the error - you have to modify your process to insert one row at a time, and then see which one fails. That's a pain, to put it mildly.
错误看起来不像这样有什么原因吗?
Is there any reason that the error doesn't look more like this?
String or Binary data would be truncated
Error inserting value "Some 18 char value" into SomeTable.SomeColumn VARCHAR(10)
如果不是表结构本身,这将使查找和更正值变得更加容易.如果查看表数据是一个安全问题,那么可能是通用的,比如给出尝试值的长度和失败列的名称?
That would make it a lot easier to find and correct the value, if not the table structure itself. If seeing the table data is a security concern, then maybe something generic, like giving the length of the attempted value and the name of the failing column?
推荐答案
事实证明,在 MS Connect 上有一个开放的功能请求" - 如果您希望更改功能,我鼓励您投票支持.
It turns out there's an open "feature request" for this on MS Connect - I'd encourage you to vote for it if you'd like the functionality changed.
https://connect.microsoft.com/SQLServer/feedback/details/339410/
添加:
实际上,自育空地区于 2005 年开发以来,似乎还有另一个要求同样功能(尽管名称不佳)的请求非常出色,我也鼓励人们投票支持:
It actually looks like there's another request for this same feature (though poorly named) that's been outstanding since Yukon's development in 2005 that I'd encourage people to vote for as well:
https://connect.microsoft.com/SQLServer/feedback/details/125347/
2016 年更新
微软似乎试图删除这个漏洞真实年龄的证据.很公平.找到 旧网站存档在这里.
It seems Microsoft has tried to delete evidence of this bug's true age. Fair enough. Find the old site archived here.
相关文章