HI
I am using StringToDate funtion in a transformer (Parallel job)
if Out_rdmNdcLstRun_seq.END_DATE="" then "" else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd")
But I am getting warnings like
Conversion error calling conversion routine date_from_string data may have been lost
I checked my data and my date values are in the format of 9999-12-31 and I don't have any null values . Even then I am getting warnings like that .
Can anybody help me in fixing that . I would appreciate any input .
Thanks.
Date_from_string Warnings
Moderators: chulett, rschirm, roy
Date_from_string Warnings
Regards
Lotus26
Lotus26
-
- Premium Member
- Posts: 783
- Joined: Mon Jan 16, 2006 10:17 pm
- Location: Sydney, Australia
try this
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd".
what is the default date format in your project/job. if you have not changed then i must be yyyy-mm-dd only.
then try this code
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else Trim(Out_rdmNdcLstRun_seq.END_DATE)
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd".
what is the default date format in your project/job. if you have not changed then i must be yyyy-mm-dd only.
then try this code
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else Trim(Out_rdmNdcLstRun_seq.END_DATE)
can you check if that this field doesn't have null values and from the source it is defined as Not nullable and it is of varchar/char datatype?
Remove the 'Trim' function on 'Out_rdmNdcLstRun_seq.END_DATE'
Modify the code :
from:
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd".
To:
If Trim(col) <> '' Then StringToDate(col,"%yyyy-%mm-%dd") Else ''
let see if the resolves the issue
Remove the 'Trim' function on 'Out_rdmNdcLstRun_seq.END_DATE'
Modify the code :
from:
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then "" else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd".
To:
If Trim(col) <> '' Then StringToDate(col,"%yyyy-%mm-%dd") Else ''
let see if the resolves the issue
Thanks and Regards!!
dspxlearn
dspxlearn
What is your source and target nullability?
If your target is nullable yes, then
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then @NULL else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd")
If your target is nullable no then you will have to give some default value for date. like
if Trim(Out_rdmNdcLstRun_seq.END_DATE)=""
then
StringToDate("0000-00-00","%yyyy-%mm-%dd") else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd")
If your target is nullable yes, then
if Trim(Out_rdmNdcLstRun_seq.END_DATE)="" then @NULL else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd")
If your target is nullable no then you will have to give some default value for date. like
if Trim(Out_rdmNdcLstRun_seq.END_DATE)=""
then
StringToDate("0000-00-00","%yyyy-%mm-%dd") else StringToDate(Trim(Out_rdmNdcLstRun_seq.END_DATE),"%yyyy-%mm-%dd")