convert char to date
Moderators: chulett, rschirm, roy
convert char to date
Hi
In Source I have two columns one is eff_month, eff_year. those data type is char.
I want to load in target as due_date (data type date) as month/year.
I am doing concadination using to_date. in oracle it is working but in data stage I am getting error.
Can any one help me how to do this rek.
Thanks in Advance
In Source I have two columns one is eff_month, eff_year. those data type is char.
I want to load in target as due_date (data type date) as month/year.
I am doing concadination using to_date. in oracle it is working but in data stage I am getting error.
Can any one help me how to do this rek.
Thanks in Advance
Re: convert char to date
Hi, in datastage you have to have year, month and date all three in a date. The error must be because of that.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
Please post what you tried in DataStage. You can concatenate the columns and then use the StringToDate() function.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You posted this in the PX forum, but marked it as a Server job ... which is it?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01")
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.
Ray,
So, below code along with the date format masking, we will be getting all '01' for days right?
How about the below code.I guess we will be getting only the month/year.
Ofcourse, if the target is a text file and not the database.
So, below code along with the date format masking, we will be getting all '01' for days right?
Code: Select all
StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01")
Code: Select all
MonthFromDate(StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01","%yyyy-%mm-%dd")) : '/' :YearFromDate(StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01","%yyyy-%mm-%dd"))
Thanks and Regards!!
dspxlearn
dspxlearn
Very funnydspxlearn wrote:Ray,
So, below code along with the date format masking, we will be getting all '01' for days right?How about the below code.I guess we will be getting only the month/year.Code: Select all
StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01")
Ofcourse, if the target is a text file and not the database.Code: Select all
MonthFromDate(StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01","%yyyy-%mm-%dd")) : '/' :YearFromDate(StringToDate(InLink.Eff_Year : "-" : InLink.Eff_Month : "-01","%yyyy-%mm-%dd"))
InLink.Eff_Year and InLink.Eff_Month already has year and month. So if he just needs a string with year/moth, he can directly concatenate them.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
Re: convert char to date
why same post at two different locationsdeva wrote:Hi
In Source I have two columns one is eff_month, eff_year. those data type is char.
I want to load in target as due_date (data type date) as month/year.
I am doing concadination using to_date. in oracle it is working but in data stage I am getting error.
Can any one help me how to do this rek.
Thanks in Advance
viewtopic.php?t=116304
Re: convert char to date
Sadly, some people REALLY take this site for granted.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.