T-SQL 算术溢出:哪一列?

2021-09-10 00:00:00 tsql sql-server

在 MS SQL Server 2005 中,当在 INSERT 过程中遇到将数字转换为数字类型的算术溢出错误"时,是否可以发现是哪个列的输入值导致了错误?

In MS SQL Server 2005, when encountering an "Arithmetic overflow error converting numeric to data type numeric" during an INSERT, is it possible to discover which column's input value caused the error?

似乎有许多类似的转换错误没有报告哪一列引起了麻烦.这使得在大型查询中修复错误变得相当困难.有没有其他方法可以解决这个问题?

There seems to be a number of similar conversion errors that don't report which column provoked the trouble. This makes fixing mistakes rather difficult in huge queries. Is there some other way to deal with this?

推荐答案

据我所知,不,您无法获得错误消息以显示哪个列失败.但是,如果您知道要插入的内容,您应该能够找到错误所在.为什么不放表结构和插入查询.

As far as i know, No, you can't get the error message to show you in which column is failing. But, if you know what you are inserting you should be able to find where the error is. Why don't you put the table structure and the insert query.

相关文章