Skip to content


Whats the right way for importing dates ?

Mike Tsui asked 2 years ago
I have source file using YYYYMMDD as date from a CSV file,  sql is expecting YYYY-MM-DD.    Whats the best way to import this correctly into sql ?  pretask or use calculated in column type or something else ?  
Patrick Roth Staff answered 2 years ago
You would want to use a calculation of some sort.
Either a “Date” calculation
or you could code it yourself
How you manipulate the field depends more on how SC is reading the field.  Is it coming in as a string?  The date calculation works really nicely for that.
If it comes in as an actual “date” field then the scripting method such as the 2nd forum post would work nicely.
Mike Tsui answered 2 years ago
Its a csv file, so apparently I read it wrong,  it was YYYYDDMM and I can’t directly import it into a date column since sql did not know that format.   As of now, I import it as a string and use sql substring task to rebuild it as YYYY-MM-DD into a formatted date column.   Ill try the calculation method you mention.  
Thanks for the info

If you would like to submit an answer or comment, please sign in to the eOne portal.