我有一個DB2 SQL查詢,我需要將其作爲Crystal Reports文件的一部分通過數據庫專家中的添加命令。我詢問去如下:DB2:詳細信息:42S22:[IBM] [CLI驅動程序] [DB2] SQL0206N {colname}在使用它的上下文中無效
select "V_SIA_HIST_UTIL"."ID_HISTQ_UTILT_GIA"
, "V_SIA_HIST_UTIL"."PRENM_UTILT_GIA"
, "V_SIA_HIST_UTIL"."NM_UTILT_GIA"
, "V_SIA_HIST_UTIL"."CD_UTILT_GIA"
, "V_SIA_HIST_UTIL"."DH_DERNI_MODIF_UTILT_GIA"
, "V_SIA_HIST_UTIL"."ID_HIST_UTILT_GIA_PAREN"
, "pag"."nom_type"
, "pag"."nom"
, "pag"."description"
, "pag"."nom_affiche"
, "pag"."tri"
, "pag"."id_utilisateur"
from "TEST"."V_SIA_HIST_UTIL"
full outer join (
select "p"."nom_type"
, "p"."nom"
, "p"."description"
, "p"."nom_affiche"
, "p"."tri"
, "p"."id_utilisateur"
from (
select 'p' as "nom_type"
, "V_SIA_HST_ROL_SECU"."NM_ROLE_SECUR_GIA" as "nom"
, CAST(NULL AS VARCHAR(128)) as "description"
, CAST(NULL AS VARCHAR(128)) as "nom_affiche"
, 0 as "tri"
, "V_SIA_JC_ROLS_UTIL"."ID_HISTQ_UTILT_GIA" as "id_utilisateur"
from "TEST"."V_SIA_HST_ROL_SECU"
inner join "TEST"."V_SIA_JC_ROLS_UTIL" on "V_SIA_JC_ROLS_UTIL"."ID_HISTQ_ROLE_SECUR_GIA" = "V_SIA_HST_ROL_SECU"."ID_HISTQ_ROLE_SECUR_GIA"
union
select 'a' as "nom_type"
, "V_SIA_HST_ASG_RESS"."NM_ASSGN_RESRC_GIA" as "nom"
, "V_SIA_HST_ASG_RESS"."DESCN_ASSGN_RESRC_GIA" as "description"
, "V_SIA_HST_ASG_RESS"."NM_AFFIC_ASSGN_GIA" as "nom_affiche"
, 1 as "tri"
, "V_SIA_JC_ASSG_UTIL"."ID_HISTQ_UTILT_GIA" as "id_utilisateur"
from "TEST"."V_SIA_HST_ASG_RESS"
inner join "TEST"."V_SIA_JC_ASSG_UTIL" on "V_SIA_JC_ASSG_UTIL"."ID_HIST_ASSGN_RESRC_GIA" = "V_SIA_HST_ASG_RESS"."ID_HIST_ASSGN_RESRC_GIA"
union
select 'g' as "nom_type"
, "V_SIA_HST_GRP_SECU"."NM_GROUP_SECUR_GIA" as "nom"
, CAST(NULL AS VARCHAR(128)) as "description"
, CAST(NULL AS VARCHAR(128)) as "nom_affiche"
, 2 as "tri"
, "V_SIA_JC_GRPS_UTIL"."ID_HISTQ_UTILT_GIA" as "id_utilisateur"
from "TEST"."V_SIA_HST_GRP_SECU"
inner join "TEST"."V_SIA_JC_GRPS_UTIL" on "V_SIA_JC_GRPS_UTIL"."ID_HISTQ_GROUP_SECUR_GIA" = "V_SIA_HST_GRP_SECU"."ID_HISTQ_GROUP_SECUR_GIA"
) "p"
) "pag" on "pag"."id_utilisateur" = "V_SIA_HIST_UTIL"."ID_HISTQ_UTILT_GIA"
。由此Crystal Reports的錯誤信息,我從數據庫專家得到,當它試圖驗證對底層的DB2數據中心查詢:
無法檢索數據來自數據庫。
詳細說明:42S22:[IBM] [CLI驅動程序] [DB2] SQL0206N
「V_SIA_HST_ROL_SECU.NM_ROLE_SECUR_GIA」 不是在其被使用的
上下文中有效。 SQLSTATE = 42703
[數據庫供應商代碼:-206]
我忘了提,任何這些建議的原因似乎並不適用於我的查詢。
DB2 SQL-Error: -206 SQLState: 42703
運行同樣的查詢就好了針對SQL Server 2005
任何線索,如何解決這個問題呢?這是我第一次使用DB2,我甚至在今天早上剛剛安裝了DB2數據中心客戶端(DB2 Connect)!
在此先感謝大家! =)
是的,它絕對是。我只是驗證過,以便我可以確定它。感謝您的輸入。 =) – 2011-01-28 18:57:25