为什么不是“字符串或二进制数据将被截断”一个更具描述性的错误? [英] Why isn't "String or Binary data would be truncated" a more descriptive error?

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

问题描述

开始:我明白这个错误的含义 - 我不是试图解析它的实例。

众所周知难以排除故障,因为如果你得到它插入一百万行到表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 /

ADDED:

喜欢有另一个请求,这个相同的功能(虽然命名不当),自从育空在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

似乎Microsoft已尝试删除bug的真实年龄。很公平。查找旧网站已存档

It seems Microsoft has tried to delete evidence of this bug's true age. Fair enough. Find the old site archived here.

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

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