INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

DW Union problem in PB12 (Classic)/DB2

DW Union problem in PB12 (Classic)/DB2

(OP)
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

RE: DW Union problem in PB12 (Classic)/DB2

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"
www.anvil-of-time.com

RE: DW Union problem in PB12 (Classic)/DB2

(OP)
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...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close