系统在查询时报错,具体信息为varchar转换为bigint错误,但是只是部分数据出现问题,说明不是sql语句问题,为了排查是哪行数据出现问题,可以通过以下语句:
SELECT * FROM TABLE WHERE ISNUMERIC(COLUMN)=0 and COLUMN is not null
比如:SELECT top 10 * FROM crm_caseRelation(nolock) WHERE ISNUMERIC(relationId) = 0 and relationId is not null
判断空格:-- 判断空格
select top 10 charindex(' ',cr.RelationID),cr.id,cr.RelationID
from tableName(nolock) cr
where
createTime > '2014-11-03'
and createTime < '2014-11-04'
and charindex(' ',cr.RelationID) > 0
and cr.RelationID is not null
本文介绍了一种通过SQL查询语句来定位在转换varchar为bigint时出现错误的具体数据行的方法,包括判断空格和特定日期范围内的数据筛选。
1382

被折叠的 条评论
为什么被折叠?



