text: -- view test (LER-635)
  SELECT * FROM (
    SELECT * FROM (
      SELECT 
        "TG"."TIME_KEY_SEQ" AS "DATE_KEY", 
        "TG"."TIME_KEY" AS "CAL_DATE",
        SUBSTRING(CAST("TG"."TIME_KEY" AS VARCHAR(64)) FROM 6 FOR 2) || 
          SUBSTRING(CAST("TG"."TIME_KEY" AS VARCHAR(64)) FROM 9 FOR 2) ||
          SUBSTRING(CAST("TG"."TIME_KEY" AS VARCHAR(64)) FROM 1 FOR 4) 
          AS "CAL_DATE_STR",
        "TG"."DAY_NUMBER_IN_YEAR" AS "DAY_NUM_YEAR", 
        "TG"."WEEK_NUMBER_IN_YEAR" AS "CAL_WEEK_NUM", 
        _ISO-8859-1'W' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."WEEK_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "CAL_WEEK_STR",
        CAST("TG"."YR" AS VARCHAR(4)) || _ISO-8859-1'-' || _ISO-8859-1'W' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."WEEK_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "CAL_WEEKYR_STR",
        "TG"."MONTH_NUMBER_IN_YEAR" AS "CAL_MONTH_NUM", 
        "TG"."MONTH_NAME" AS "CAL_MONTH_NAME", 
        CAST("TG"."YR" AS VARCHAR(4)) ||_ISO-8859-1'-' || _ISO-8859-1'M' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END ||
          CAST("TG"."MONTH_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "CAL_MONTHYR_STR", 
        "TG"."QUARTER" AS "CAL_QUARTER_NUM",
        _ISO-8859-1'Q' || 
          CAST("TG"."QUARTER" AS VARCHAR(2)) AS "CAL_QUARTER_STR",
        CAST("TG"."YR" AS VARCHAR(4)) || _ISO-8859-1'-' ||
          _ISO-8859-1'Q' || 
          CAST("TG"."QUARTER" AS VARCHAR(2)) AS "CAL_QUARTERYR_STR", 
        "TG"."YR" AS "CAL_YEAR_NUM",
        CAST("TG"."YR" AS VARCHAR(4)) AS "CAL_YEAR_STR", 
        CASE WHEN "TG"."WEEKEND" = _ISO-8859-1'Y' THEN 0 ELSE 1 END AS "WEEKEND",
        CASE WHEN "TG"."QUARTER" = 1 THEN _ISO-8859-1'Winter' 
          WHEN "TG"."QUARTER" = 2 THEN _ISO-8859-1'Spring' 
          WHEN "TG"."QUARTER" = 3 THEN _ISO-8859-1'Summer' 
          WHEN "TG"."QUARTER" = 4 THEN _ISO-8859-1'Fall' 
            ELSE _ISO-8859-1'' END AS "SEASON",
        "TG"."WEEK_NUMBER_IN_YEAR" AS "FSC_WEEK_NUM", 
        _ISO-8859-1'W' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."WEEK_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "FSC_WEEK_STR",
        CAST("TG"."YR" AS VARCHAR(4)) || _ISO-8859-1'-' || _ISO-8859-1'W' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."WEEK_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "FSC_WEEKYR_STR",
        "TG"."MONTH_NUMBER_IN_YEAR" AS "FSC_MONTH_NUM", 
        _ISO-8859-1'M' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."MONTH_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "FSC_MONTH_STR",
        CAST("TG"."YR" AS VARCHAR(4)) || _ISO-8859-1'-' || _ISO-8859-1'M' || 
          CASE WHEN "TG"."WEEK_NUMBER_IN_YEAR" < 10 
            THEN _ISO-8859-1'0' ELSE _ISO-8859-1'' END || 
          CAST("TG"."MONTH_NUMBER_IN_YEAR" AS VARCHAR(2)) AS "FSC_MONTHYR_STR",
        "TG"."QUARTER" AS "FSC_QUARTER_NUM", 
        _ISO-8859-1'Q' || 
          CAST("TG"."QUARTER" AS VARCHAR(2)) AS "FSC_QUARTER_STR",
        CAST("TG"."YR" AS VARCHAR(4)) || _ISO-8859-1'-' || _ISO-8859-1'Q' || 
          CAST("TG"."QUARTER" AS VARCHAR(2)) AS "FSC_QUARTERYR_STR", 
        "TG"."YR" AS "FSC_YEAR_NUM",
        CAST("TG"."YR" AS VARCHAR(4)) AS "FSC_YEAR_STR"
      FROM (
        SELECT 
          "EXPR$0"."TIME_KEY_SEQ", "EXPR$0"."TIME_KEY", "EXPR$0"."DAY_OF_WEEK", 
          "EXPR$0"."WEEKEND", "EXPR$0"."DAY_NUMBER_IN_WEEK", 
          "EXPR$0"."DAY_NUMBER_IN_MONTH", "EXPR$0"."DAY_NUMBER_IN_YEAR",
          "EXPR$0"."DAY_NUMBER_OVERALL", "EXPR$0"."WEEK_NUMBER_IN_YEAR", 
          "EXPR$0"."WEEK_NUMBER_OVERALL", "EXPR$0"."MONTH_NAME",
          "EXPR$0"."MONTH_NUMBER_IN_YEAR", "EXPR$0"."MONTH_NUMBER_OVERALL", 
          "EXPR$0"."QUARTER", "EXPR$0"."YR", "EXPR$0"."CALENDAR_QUARTER", 
          "EXPR$0"."FIRST_DAY_OF_WEEK"
        FROM TABLE(SPECIFIC "LOCALDB"."APPLIB"."TIME_DIMENSION"(
          2004, 1, 1, 2005, 12, 31)) AS "EXPR$0"
      ) AS "TG"
    ) AS "V_TIME_GENERATOR"
  );
  