Hi,
I have a source datacolumn seldate in the form of 99991231 coming from a flatfile. Length of this field is varchar 8
I have to insert that to DB2 table using a DB2 enterprise stage. I am following the steps below.
1 In the derivation of transformer stage I am using the following function.
StringToDate(incolumn,'%yyyy%mm%dd') and My target column datatype is Date....
Everything fine...I am getting output also but the issue is I am getting a disturbing warning though I think I did all right.. Please can anyone tell me what is the reason for this warning.
APT_CombinedOperatorController(0),0: Conversion error calling conversion routine date_from_string data may have been lost
Date conversion Error
Moderators: chulett, rschirm, roy
Re: Date conversion Error
You might miss dashes, try this:
StringToDate(incolumn,'%yyyy-%mm-%dd')
StringToDate(incolumn,'%yyyy-%mm-%dd')
Re: Date conversion Error
You might miss dashes, try this:
StringToDate(incolumn,'%yyyy-%mm-%dd')
StringToDate(incolumn,'%yyyy-%mm-%dd')
-
- Premium Member
- Posts: 238
- Joined: Fri Jul 25, 2008 8:55 am
Re: Date conversion Error
Not actully. Since my input source don't have the format 9999-12-31, I did not use that format. Any helpsohasaid wrote:You might miss dashes, try this:
StringToDate(incolumn,'%yyyy-%mm-%dd')
-
- Premium Member
- Posts: 730
- Joined: Tue Nov 04, 2008 10:14 am
- Location: Bangalore
Re: Date conversion Error
The above warning comes when DataStage encounters a string that cannot be converted to date for example "99991331"---->here month is 13 which is invalidmyukassign wrote:Hi,
APT_CombinedOperatorController(0),0: Conversion error calling conversion routine date_from_string data may have been lost
To handle this situation do nt blindly convert dates use IsValid('Date',<column name>) function as shown below.
If IsValid('Date',<column name>) then StringToDate(incolumn,'%yyyy%mm%dd') else SetNull()
-
- Participant
- Posts: 22
- Joined: Tue Jul 21, 2009 4:45 am
- Location: Chennai
- Contact:
Check in the flat file for conversion to date. Declare the variable as DATE in the MATEDATA during extraction through Flat file and goto FORMAT-->DATE-->FORMAT STRING and give the format of incoming date there as YYYYMMDD or YYYY-MM-DD.
Note the incoming string is VARCHAR datatype but the date conversion will happen when you have mentioned the same coulmn as DATE in the Metadata and date format as specified.
This would work for a Flat file i hope.
Thanks and regards,
Note the incoming string is VARCHAR datatype but the date conversion will happen when you have mentioned the same coulmn as DATE in the Metadata and date format as specified.
This would work for a Flat file i hope.
Thanks and regards,
Thanks & regards
Satish R
Satish R
-
- Premium Member
- Posts: 238
- Joined: Fri Jul 25, 2008 8:55 am