[英]SQL Server 2012 Error converting data type varchar to numeric
I have a very big view that uses many tables and other views. 我有一个很大的视图,它使用许多表和其他视图。 When I select * from this big view, I get an error 当我从这个大视图中选择*时,出现错误
error converting data type varchar to numeric 将数据类型varchar转换为数值时出错
The problem is I don't know where exactly it happens. 问题是我不知道它到底发生在哪里。 Do I have to drill into all the involved objects, or there is a way to know where exactly is the problem? 我是否必须深入研究所有涉及的对象,还是有办法知道问题出在哪里?
it could also be a function like: 它也可能是一个像这样的函数:
declare @pippo numeric
set @pippo=null
select ISNULL(@pippo, 'x')
this will raise same conversion error 这将引发相同的转换错误
hope this help 希望这个帮助
Take the definition of the view, and make it into a SELECT statement. 获取视图的定义,并将其放入SELECT语句中。 Then remove half the columns and run it, keep removing columns until the problem goes away. 然后取出一半的色谱柱并运行,继续除去色谱柱,直到问题消除。 If it goes away, then add them back until you find the problem. 如果消失,则将它们重新添加,直到找到问题。 If it doesn't go away, then the problem is in a join. 如果没有解决,那么问题就出在联接中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.