无法解析 ORDER BY 中第 1 列的排序规则冲突
Cannot resolve collation confilct for column 1 in ORDER BY
当我执行查询时,我得到这个 SQL 异常:
Cannot resolve collation conflict for column 1 in ORDER BY statement
SELECT ISNULL(ROW_NUMBER() OVER (ORDER BY ARTICLE), 0) AS NBR, DATE, ARTICLE, TYPE, QTE_FRN, QTE_DEPOT, QTE_PAT, QTE_MOUV, CHAMP_STOCK,
DEPOT
FROM (SELECT dbo.V_STOCK.DATE, dbo.V_STOCK.ARTICLE, dbo.V_STOCK.TYPE, CASE WHEN TYPE IN (100, 101, 103, 200) THEN QTE WHEN TYPE IN (102, 204)
THEN - 1 * QTE END AS QTE_FRN, CASE WHEN TYPE IN (201, 203) THEN QTE WHEN TYPE = 202 THEN - 1 * QTE END AS QTE_DEPOT,
CASE WHEN TYPE IN (300, 301, 303) THEN QTE WHEN TYPE = 302 THEN - 1 * QTE END AS QTE_PAT, CASE WHEN TYPE IN (402, 502, 602)
THEN QTE WHEN TYPE IN (401, 501, 601) THEN - 1 * QTE END AS QTE_MOUV, dbo.NXT_PH_CHOIX_MODULE.CHAMP_STOCK, dbo.V_STOCK.DEPOT
FROM dbo.NXT_PH_CHOIX_MODULE RIGHT OUTER JOIN
dbo.V_STOCK ON dbo.NXT_PH_CHOIX_MODULE.TYPE_CHOIX = dbo.V_STOCK.TYPE
UNION ALL
SELECT NextCare.dbo.V_STOCK_PHARMACIE.DATE, NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE, NextCare.dbo.V_STOCK_PHARMACIE.TYPE,
NextCare.dbo.V_STOCK_PHARMACIE.QTE_FRN, NextCare.dbo.V_STOCK_PHARMACIE.QTE_DEPOT, NextCare.dbo.V_STOCK_PHARMACIE.QTE_PAT,
NextCare.dbo.V_STOCK_PHARMACIE.QTE_MOUV, NXT_PH_CHOIX_MODULE_1.CHAMP_STOCK, NextCare.dbo.V_STOCK_PHARMACIE.DEPOT
FROM dbo.NXT_PH_CHOIX_MODULE AS NXT_PH_CHOIX_MODULE_1 RIGHT OUTER JOIN
NextCare.dbo.V_STOCK_PHARMACIE ON NXT_PH_CHOIX_MODULE_1.TYPE_CHOIX = NextCare.dbo.V_STOCK_PHARMACIE.TYPE) AS VIEW_S
您的 ARTICLE 包含的字符串(我猜它们是 dbo.V_STOCK.ARTICLE 和 NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE)似乎具有不同的排序规则。尝试将 COLLATE DATABASE_DEFAULT 添加到脚本中的字符串字段:dbo.V_STOCK.ARTICLE COLLATE DATABASE_DEFAULT
和 NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE COLLATE DATABASE_DEFAULT
。
有关 callatoin 的更多信息,请参阅:
https://msdn.microsoft.com/en-us/library/ms184391.aspx 或
Cannot resolve collation conflict for column 4 in SELECT statement
当我执行查询时,我得到这个 SQL 异常:
Cannot resolve collation conflict for column 1 in ORDER BY statement
SELECT ISNULL(ROW_NUMBER() OVER (ORDER BY ARTICLE), 0) AS NBR, DATE, ARTICLE, TYPE, QTE_FRN, QTE_DEPOT, QTE_PAT, QTE_MOUV, CHAMP_STOCK,
DEPOT
FROM (SELECT dbo.V_STOCK.DATE, dbo.V_STOCK.ARTICLE, dbo.V_STOCK.TYPE, CASE WHEN TYPE IN (100, 101, 103, 200) THEN QTE WHEN TYPE IN (102, 204)
THEN - 1 * QTE END AS QTE_FRN, CASE WHEN TYPE IN (201, 203) THEN QTE WHEN TYPE = 202 THEN - 1 * QTE END AS QTE_DEPOT,
CASE WHEN TYPE IN (300, 301, 303) THEN QTE WHEN TYPE = 302 THEN - 1 * QTE END AS QTE_PAT, CASE WHEN TYPE IN (402, 502, 602)
THEN QTE WHEN TYPE IN (401, 501, 601) THEN - 1 * QTE END AS QTE_MOUV, dbo.NXT_PH_CHOIX_MODULE.CHAMP_STOCK, dbo.V_STOCK.DEPOT
FROM dbo.NXT_PH_CHOIX_MODULE RIGHT OUTER JOIN
dbo.V_STOCK ON dbo.NXT_PH_CHOIX_MODULE.TYPE_CHOIX = dbo.V_STOCK.TYPE
UNION ALL
SELECT NextCare.dbo.V_STOCK_PHARMACIE.DATE, NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE, NextCare.dbo.V_STOCK_PHARMACIE.TYPE,
NextCare.dbo.V_STOCK_PHARMACIE.QTE_FRN, NextCare.dbo.V_STOCK_PHARMACIE.QTE_DEPOT, NextCare.dbo.V_STOCK_PHARMACIE.QTE_PAT,
NextCare.dbo.V_STOCK_PHARMACIE.QTE_MOUV, NXT_PH_CHOIX_MODULE_1.CHAMP_STOCK, NextCare.dbo.V_STOCK_PHARMACIE.DEPOT
FROM dbo.NXT_PH_CHOIX_MODULE AS NXT_PH_CHOIX_MODULE_1 RIGHT OUTER JOIN
NextCare.dbo.V_STOCK_PHARMACIE ON NXT_PH_CHOIX_MODULE_1.TYPE_CHOIX = NextCare.dbo.V_STOCK_PHARMACIE.TYPE) AS VIEW_S
您的 ARTICLE 包含的字符串(我猜它们是 dbo.V_STOCK.ARTICLE 和 NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE)似乎具有不同的排序规则。尝试将 COLLATE DATABASE_DEFAULT 添加到脚本中的字符串字段:dbo.V_STOCK.ARTICLE COLLATE DATABASE_DEFAULT
和 NextCare.dbo.V_STOCK_PHARMACIE.ARTICLE COLLATE DATABASE_DEFAULT
。
有关 callatoin 的更多信息,请参阅:
https://msdn.microsoft.com/en-us/library/ms184391.aspx 或
Cannot resolve collation conflict for column 4 in SELECT statement