saved4use
asked on
DB2 Union All - blank date fields
I wrote an UNION ALL DB2 query statement and got the error msg below. How can I fix this?
**FYI, both statement run perfectly individually, but throw errors when I do UNION ALL.
Thanks.
"DB2 Database Error: ERROR [22007] [IBM][DB2/AIX64] SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007"
select
b.clrg_cor_num
,r.beta_rep_cd
,ar.beta_acct_num
,ar.lookup_1_txt
,t.cmpl_rstr_ind
,t.CMPL_RSTR_ADD_DT
,t.inac_36mo_ind
,t.INAC_36MO_ADD_DT
,''
,df.asset_amt as AUM
FROM DW.ACCT_REF AR
UNION ALL
select
b.clrg_cor_num
,r.beta_rep_cd
,ar.beta_acct_num
,ar.lookup_1_txt
,''
,''
,''
,''
,ar.DOC_RSTRCT_IND
,df.asset_amt as AUM
FROM DW.ACCT_REF AR
**FYI, both statement run perfectly individually, but throw errors when I do UNION ALL.
Thanks.
"DB2 Database Error: ERROR [22007] [IBM][DB2/AIX64] SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007"
select
b.clrg_cor_num
,r.beta_rep_cd
,ar.beta_acct_num
,ar.lookup_1_txt
,t.cmpl_rstr_ind
,t.CMPL_RSTR_ADD_DT
,t.inac_36mo_ind
,t.INAC_36MO_ADD_DT
,''
,df.asset_amt as AUM
FROM DW.ACCT_REF AR
UNION ALL
select
b.clrg_cor_num
,r.beta_rep_cd
,ar.beta_acct_num
,ar.lookup_1_txt
,''
,''
,''
,''
,ar.DOC_RSTRCT_IND
,df.asset_amt as AUM
FROM DW.ACCT_REF AR
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.