Hi,
My source is flatfile . I have date data in varchar type iin my source.
My goal is covert the varchar to date format and vheck for valid date format (%yyyy-%mm-%dd)
In Transformation In Constrains I used following
IsValid( DSLink2.Date,TrimLeadingTrailing( StringToDate(DSLink2.Date,"%yyyy-%mm-%dd")))
And in column Derivation i trie dthe following:
If len(TrimLeadingTrailing( DSLink2.Date))=10 Then StringToDate(DSLink2.Date,"%yyyy-%mm-%dd") Else ' '
But it is not working . Please can any body tell me the solutions
converting varchar to Date and validation
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
IsValid() tests the string. Don't apply StringToDate() first. What you really want is something like
Code: Select all
If IsValid(InLink.TheString, "date") Then StringToDate(InLink.TheString) Else SetNull()
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.