消息8115,级别16,状态2,行1:将%ls转换为数据类型%ls的算术溢出错误

时间:2014-01-10 15:37:54

标签: sql database sql-server-2008 sql-server-2005

我在SQL Server 2005上运行此查询并收到错误。找不到此问题的根本原因。

请帮助解决此问题。此问题是否特定于版本,仅适用于SQL Server 2005而不是2008年?

SELECT "AAA1_before_Final13"."AAA1"            AS "level0key",
  "AAA1_before_Final13"."Reporting_Month_Year" AS "levelkey",
  "AAA1_before_Final13"."Reporting_Period"     AS "Reporting_Period",
  "Charge_Type14"."U_INV_CHG_TYPE"             AS "level1key",
  MIN(1)                                       AS "rowCount",
  SUM("AAA1_before_Final13"."Lag_Days")        AS "Lag_Days",
  SUM("AAA1_before_Final13"."Invoice_Count")   AS "Invoice_Count"
FROM
  (SELECT "AAA111"."Division_Name"     AS "Division_Name",
    "AAA111"."Original_FSC"            AS "Original_FSC",
    "AAA111"."FSC_Class"               AS "FSC_Class",
    "AAA111"."FSC_Name"                AS "FSC_Name",
    "AAA111"."Billing_Area_Category"   AS "Billing_Area_Category",
    "AAA111"."Billing_Area"            AS "Billing_Area",
    "dateDim12"."Reporting_Period"     AS "Reporting_Period",
    "dateDim12"."Reporting_Month_Year" AS "Reporting_Month_Year",
    "AAA111"."AAA1"                    AS "AAA1",
    "AAA111"."Lower_Range"             AS "Lower_Range",
    "AAA111"."Upper_Range"             AS "Upper_Range",
    SUM("AAA111"."Lag_Days")           AS "Lag_Days",
    SUM("AAA111"."Inv_Count")          AS "Invoice_Count",
    "AAA111"."GRP"                     AS "GRP"
  FROM
    (SELECT "idxAnalyzer"."dbo"."Date_Dim"."Reporting_Period" AS "Reporting_Period",
      "idxAnalyzer"."dbo"."Date_Dim"."Reporting_Month_Year"   AS "Reporting_Month_Year",
      "idxAnalyzer"."dbo"."Date_Dim"."Reporting_Year"         AS "Reporting_Year",
      "idxAnalyzer"."dbo"."Date_Dim"."Deposite_Days"          AS "Deposite_Day",
      "idxAnalyzer"."dbo"."Date_Dim"."Deposite_Days"          AS "Deposite_Day1",
      "idxAnalyzer"."dbo"."Date_Dim"."Deposite_Days"          AS "Deposite_Day_Grp"
    FROM "idxAnalyzer"."dbo"."Date_Dim"
    WHERE "idxAnalyzer"."dbo"."Date_Dim"."Reporting_Year" = 2013
    AND "Date_Dim"."Day_of_Month"                         = 1
    ) "dateDim12"
  LEFT OUTER JOIN
    (SELECT "AAA1_Lag_Days"."Reporting_Period" AS "Reporting_Period",
      "AAA1_Lag_Days"."Division_Name"          AS "Division_Name",
      "AAA1_Lag_Days"."FSC_Class"              AS "FSC_Class",
      "AAA1_Lag_Days"."Original_FSC"           AS "Original_FSC",
      "AAA1_Lag_Days"."FSC_Name"               AS "FSC_Name",
      "AAA1_Lag_Days"."Billing_Area_Category"  AS "Billing_Area_Category",
      "AAA1_Lag_Days"."Billing_Area"           AS "Billing_Area",
      SUM("AAA1_Lag_Days"."Lag_Days")          AS "Lag_Days",
      SUM("AAA1_Lag_Days"."Inv_Count")         AS "Inv_Count",
      "AAA1_Lag_Days"."Lower_Range"            AS "Lower_Range",
      "AAA1_Lag_Days"."Upper_Range"            AS "Upper_Range",
      'AAA1'                                   AS "AAA1",
      "AAA1_Lag_Days"."GRP"                    AS "GRP"
    FROM
      (SELECT "AAA1_Lag_Days"."Reporting_Period"       AS "Reporting_Period",
        "AAA1_Lag_Days"."Division_Name"                AS "Division_Name",
        "AAA1_Lag_Days"."Original_FSC"                 AS "Original_FSC",
        "AAA1_Lag_Days"."FSC_Class"                    AS "FSC_Class",
        "AAA1_Lag_Days"."FSC_Name"                     AS "FSC_Name",
        "AAA1_Lag_Days"."Billing_Area"                 AS "Billing_Area",
        "AAA1_Lag_Days"."Billing_Area_Category"        AS "Billing_Area_Category",
        "AAA1_Lag_Days"."Reporting_Period_Year"        AS "Reporting_Period_Year",
        "AAA1_Lag_Days"."Lag_Days"                     AS "Lag_Days",
        "AAA1_Lag_Days"."Inv_Count"                    AS "Inv_Count",
        "AAA1_Lag_Days"."Lower_Range"                  AS "Lower_Range",
        "AAA1_Lag_Days"."Upper_Range"                  AS "Upper_Range",
        "AAA1_Lag_Days"."Group_Num" AS "GRP"
      FROM "idxAnalyzer"."dbo"."AAA1_Lag_Days_View" "AAA1_Lag_Days"
      ) "AAA1_Lag_Days"
    WHERE (4                                    = 0
    OR 4                                        = "AAA1_Lag_Days"."GRP")
    AND "AAA1_Lag_Days"."Reporting_Period_Year" = 2013
    AND "AAA1_Lag_Days"."Lower_Range"           = 16.49
    GROUP BY "AAA1_Lag_Days"."Reporting_Period",
      "AAA1_Lag_Days"."Division_Name",
      "AAA1_Lag_Days"."FSC_Class",
      "AAA1_Lag_Days"."Original_FSC",
      "AAA1_Lag_Days"."FSC_Name",
      "AAA1_Lag_Days"."Billing_Area_Category",
      "AAA1_Lag_Days"."Billing_Area",
      "AAA1_Lag_Days"."Lower_Range",
      "AAA1_Lag_Days"."Upper_Range",
      "AAA1_Lag_Days"."GRP"
    ) "AAA111"
  ON "dateDim12"."Reporting_Period" = "AAA111"."Reporting_Period"
  GROUP BY "AAA111"."Division_Name",
    "AAA111"."Original_FSC",
    "AAA111"."FSC_Class",
    "AAA111"."FSC_Name",
    "AAA111"."Billing_Area_Category",
    "AAA111"."Billing_Area",
    "dateDim12"."Reporting_Period",
    "dateDim12"."Reporting_Month_Year",
    "AAA111"."AAA1",
    "AAA111"."Lower_Range",
    "AAA111"."Upper_Range",
    "AAA111"."GRP"
  ) "AAA1_before_Final13",
  "idxAnalyzer"."dbo"."U_INVOICE_HEADER" "Charge_Type14"
WHERE CAST ("AAA1_before_Final13"."GRP" AS BIGINT) = CAST ("Charge_Type14"."GRP" AS BIGINT)
GROUP BY "AAA1_before_Final13"."AAA1",
  "AAA1_before_Final13"."Reporting_Month_Year",
  "AAA1_before_Final13"."Reporting_Period",
  "Charge_Type14"."U_INV_CHG_TYPE"

0 个答案:

没有答案