Data Conversion - String to Date

  • I just re-did a DTS package in SQL2008 SSIS, importing a tab delimeted text file into a table. I had to convert a date field to DT_DBTIMESTAMP. I kept having failures. I changed the error output on the data conversion to ignore failure and the file imported. It was then I realized that many of the date fields were null, and it was the null dates that were causing the failures. The rows that actually contained a date imported correctly. So this works, but I know it's not right. How SHOULD I be handling the null dates?

    Thanks all.

  • Randy, I believe this is what you're looking for, but honestly, not entirely sure:

    ISNULL( <FIELD>) = TRUE ? NULL(DT_DATE) : (DT_DBTIMESTAMP) <FIELD>


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply