We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


How do I validate date format to be mmddyyyy during data conversion in SSIS

dorsun asked
Medium Priority
Last Modified: 2013-11-10
I am importing a excel file and tryinng to convert data types to match the database types.
I have a date field in the source file. I used DB_TIMESTAMP during data conversion.
But when I run the package, it throws error on the rows where the date field is empty (ie, there is 'NULL' in the source file)
Also how do I make sure that the date is in mmddyyyy format?
Please help!
Watch Question


use an expression while you are converting i.e. you should do this control and conversion in a derived column component.

FIELD_NAME == "" ? (DT_STR,8,1254)NULL(DT_STR,4,1254) : FIELD_NAME

here 1254 is the code page and you should change it to your code page. this expression returns the date values and NULL for the empty ones.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Use a conditional expression: «boolean_expression» ? «when_true» : «when_false»
Here is the expression, assuming your column from the file was Column 0. You also need to make sure the Destination table accepts NULL values in the date column.
LEN(TRIM([Column 0])) > 1 ? (DT_DBTIMESTAMP)[Column 0] : NULL(DT_DBTIMESTAMP)  


Thank you this worked


Hi tigin44,

Your solution worked in the derived column. Later I had to use data conversion to convert to database type.
The derived column type is string Unicode String [DT_WSTR]
In data conversion I want to convert to DBTIMESTAMP. Since the data type of the column in the database is of datetime.
When I run the package, I get an error 'Data conversion failed while converting column birth_date_dc(derived column) to column birth_date_db (database)

Please help me out in this,

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.