hi,
I am using the db2 stage to extract the using the query to fetch the records from column using the logic expression
YEAR(TO_DATE(AUC_SALE_DATE,'yyyy-mm-dd')) || '-' || WEEK(TO_DATE(AUC_SALE_DATE,'yyyy-mm-dd'))
the results from this query coming as
2012-5
2012-44
2011-47
2012-18
2013-32
I want the last two numbers of first field like 2012-05 instead of 2012-5 .
the design of job is
db2 stage................xfm...................seqfile
in tried with following way in transformer
right((0:AUC_SALE_DATE),2) but not getting the right result like 2012-50 can you please help me about this.
logic required
Moderators: chulett, rschirm, roy
Re: logic required
Doesn't DB2 have a "to char" function?hargun wrote:I want the last two numbers of first field like 2012-05 instead of 2012-5.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Overkill. Since WEEK will never have more than two digits, the original formulation will work.ssnegi wrote:Column Derivation
DSFIELD1 : '-' : Str('0',2-len(DSFIELD2)):DSFIELD2
Code: Select all
DSFIELD1 : "-" : Right("0" : DSFIELD2, 2)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 376
- Joined: Sat Jan 07, 2012 12:25 pm
- Location: Piscataway
Which version of Db2 do you have? It's been more than a year since I last worked with Db2 but I do remember using either 'CHAR()' or 'TO_CHAR()' in a way very similar to Oracle.
(Edit)
Found this -
http://www-01.ibm.com/support/knowledge ... 007108.htm
(Edit)
Found this -
http://www-01.ibm.com/support/knowledge ... 007108.htm
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn
Life is really simple, but we insist on making it complicated.
Data Integration Consultant at AWS
Connect With Me On LinkedIn
Life is really simple, but we insist on making it complicated.