View previous topic :: View next topic |
Author |
Message |
NorthernDancer Beginner
Joined: 01 May 2007 Posts: 44 Topics: 22 Location: DOWNTOWN BUFFALO, NY
|
Posted: Fri Feb 26, 2016 11:17 am Post subject: SPUFI Update Table Columns |
|
|
I want to use SPUFI if possible to plug some columns with test data. And I want to Concatenate like parts of 2 existing columns together. So the new data becomes easily recognized. Say for example 1st 5 bytes of ZIPCODE concatenated with 1st 10 bytes of CityName. Would I just use the Concatenate character (whatever that is) between them on the SET ?? So then maybe SET HUBID = ZIPCODE(1:5)|CityName(1:10) ?? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
NorthernDancer Beginner
Joined: 01 May 2007 Posts: 44 Topics: 22 Location: DOWNTOWN BUFFALO, NY
|
Posted: Mon Feb 29, 2016 3:49 pm Post subject: |
|
|
Thank You Sir, this is it easily as you said..............
Code: |
UPDATE DB2T.OUR_CUST
SET HUB_CUST_ID =
CHAR('HUB-'||SUBSTR(ZIP_OR_POSTAL_CDE,1,5)||CHAR('-')||
SUBSTR(CIN_CUST_ID,1,9))
WHERE
ENTY_ID = 'YYYY' AND
AREA_ID = 'ZZZZ' AND
CIN_CUST_ID > ' ' AND
CIN_CUST_ID < '000061836' AND
ZIP_OR_POSTAL_CDE > ' ' AND
ADR_LINE_3 > ' ' AND
HUB_CUST_ID = ' ' AND
EXPR_DTE = '9999-12-31'
; |
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Mon Feb 29, 2016 6:48 pm Post subject: |
|
|
NorthernDancer,
Glad you got it working but I would suggest you code the sql's so that easy to read and understand. Something like this
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6
UPDATE DB2T.OUR_CUST
SET HUB_CUST_ID = CHAR(('HUB-') ||
SUBSTR(ZIP_OR_POSTAL_CDE,1,5) ||
CHAR('-') ||
SUBSTR(CIN_CUST_ID,1,9))
WHERE ENTY_ID = 'YYYY'
AND AREA_ID = 'ZZZZ'
AND CIN_CUST_ID > ' '
AND CIN_CUST_ID < '000061836'
AND ZIP_OR_POSTAL_CDE > ' '
AND ADR_LINE_3 > ' '
AND HUB_CUST_ID = ' '
AND EXPR_DTE = '9999-12-31'
;
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
NorthernDancer Beginner
Joined: 01 May 2007 Posts: 44 Topics: 22 Location: DOWNTOWN BUFFALO, NY
|
Posted: Tue Mar 01, 2016 4:31 pm Post subject: |
|
|
Yeh, I just slapped it together to test it and zap some test rows. I like your way a lot better and neater. I didn't actually know you could leave so many blanks on separate cards and it still parses together OK. |
|
Back to top |
|
|
|
|