Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DW Union problem in PB12 (Classic)/DB2

Status
Not open for further replies.

sunset

MIS
Apr 15, 1999
9
0
0
US
Hi all. Looking for assistance. I have a dw which was built in PBv6.5 (back in '98) which uses a union. Fast forward to today (PBv12.1)where I am modifying the dw to add a new timestamp field to two of the tables in the union; I actually do not get any errors, but in the 'column specifications' section of the datawindow painter changes from the actual names ( action_code, action_desc) of the columns to action_1, action_2....all of the columns in the sql/union match .... what am I missing?

SQL:
SELECT "TRSY"."TYACTNHS"."ACTION_CODE",
"TRSY"."TYACTNHS"."ACTION_COMMENTS",
"TRSY"."TYACTNHS"."ACTION_EMP", "TRSY"."TYACTNHS"."CREATE_DATE",
"TRSY"."TYACTNHS"."ACTION_ADR_NMBR",
"TRSY"."TYACTNHS"."CHECK_NMBR",
"TRSY"."TYACTNHS"."CHECK_SEQ",
"TRSY"."TYACTNHS"."ACTION_TYPE",
"TRSY"."TYACTNHS"."CREATE_TS", //timestamp "TRSY"."TYACTNCD"."ACTION_DESC"
FROM "TRSY"."TYACTNHS",
"TRSY"."TYACTNCD"
WHERE ( ( "TRSY"."TYACTNHS"."ACTION_TYPE" =
"TRSY"."TYACTNCD"."ACTION_TYPE" ) and
( "TRSY"."TYACTNHS"."ACTION_CODE" =
"TRSY"."TYACTNCD"."ACTION_CODE" ) ) and
( ( "TRSY"."TYACTNHS"."CHECK_NMBR" = :as_check_nmbr ) AND
( "TRSY"."TYACTNHS"."CHECK_SEQ" = :ai_check_seq ) )

UNION ALL

SELECT 'Comment', 'Comment', "TRSY"."TYUCMNTS"."CREATE_USERID",
Date( "TRSY"."TYUCMNTS"."CREATE_TIME"),
0,
"TRSY"."TYUCMNTS"."CHECK_NMBR",
"TRSY"."TYUCMNTS"."CHECK_SEQ",
' ' ,
"TRSY"."TYUCMNTS"."CREATE_TIME", //timestamp
' ' FROM "TRSY"."TYUCMNTS"

WHERE ( ("TRSY"."TYUCMNTS"."CHECK_NMBR" = :as_check_nmbr) and
( "TRSY"."TYUCMNTS"."CHECK_SEQ" = :ai_check_seq) )

ps this works fine in Infomaker...THANKS FOR ANY HELP
 
You can specify the name of the column in the sql.

Something like "TRSY"."TYUCMNTS"."CREATE_TIME" as create_time.

Matt

"Nature forges everything on the anvil of time"
 
Yes, this worked...note that each column in the second half of the select had to have an 'as' to match the first half of the select...
.
.
UNION ALL
SELECT 'Comment' as action_code,
'Comment' as action_comments,
"TRSY"."TYUCMNTS"."CREATE_USERID" as action_emp,
etc
etc
Thanks again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top