升级报错:错误信息:SQL 脚本: 16.000.000.0055 DATA_DPRD_PU_DTO_NL-33401 出错:子查询返回的值不止一个。
【问题现象】
升级报错:错误信息:SQL 脚本: 16.000.000.0055 DATA_DPRD_PU_DTO_NL-33401 出错:子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
【问题原因】
老版本的bug会导致查询方案产生垃圾数据,执行以下脚本可以删除垃圾数据
【解决方案】
切记备份好账套数据,再执行以下脚本去删除重复的多方案,执行脚本后再前往升级
DELETE FROM Eap_ColumnSet_User
WHERE id IN
(
SELECT r.eid
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY eSolutionID,
eUserId,
efield,
eIdSearchPlan
ORDER BY eSolutionID,
eUserId,
efield,
eIdSearchPlan
) AS rankid,
*
FROM
(
SELECT e.SolutionID AS eSolutionID,
e.UserId AS eUserId,
e.Field AS efield,
id AS eid,
e.IdSearchPlan AS eIdSearchPlan
FROM Eap_ColumnSet_User e
INNER JOIN
(
SELECT *
FROM
(
SELECT SolutionID,
UserId,
Field,
IdSearchPlan,
COUNT(*) AS y
FROM Eap_ColumnSet_User
WHERE SolutionID<>0
GROUP BY SolutionID,
UserId,
Field,
IdSearchPlan
) a
WHERE a.y > 1
) b
ON b.SolutionID = e.SolutionID
AND b.UserId = e.UserId
AND b.Field = e.Field
AND b.IdSearchPlan=e.IdSearchPlan
AND b.SolutionID<>0
) h
) r
WHERE r.rankid > 1
) AND SolutionID<>0
作者:张希文 |  时间:2022年09月30日 20:30