Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7833643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:48:44+00:00 2026-06-02T12:48:44+00:00

I have a CSV file with date column in the following format mm/dd/yyyy (4/20/2012),

  • 0

I have a CSV file with date column in the following format mm/dd/yyyy (4/20/2012), and I need to load this column into a database that has datetime column in yyyy-mm-dd (2012-04-20).

I have used derived column transformation for this purpose and written and expression like

(DT_WSTR)(SUBSTRING(ReceivedDateTime,1,4) + "-" + 
SUBSTRING(ReceivedDateTime,5,2) + "-" + SUBSTRING(ReceivedDateTime,7,2)) 

Upon running my package, it’s throwing the error Unable to perform type cast.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:48:45+00:00Added an answer on June 2, 2026 at 12:48 pm

    If the incoming values from the CSV file are always formatted like 04/20/2012 (MM/DD/YYYY), then you don’t have to perform any type casting. You just have to configure the flat file connection manager to treat the values in the file as date data type.

    Let’s assume that your CSV file looks something like this with a single column containing dates in .

    CSV file

    In the SSIS package, create a flat file connection manager to read the CSV file. I stored the CSV in the path C:\temp\Source.csv

    Flat file source general section

    On the Advanced section, you will notice that the flat file connection manager named the first column as Column1 and the DataType property is set to string [DT_STR]. However, the values in the file are actually dates. Either you can manually configure the data types or click on the Suggest Types... button.

    Advanced Suggest Types

    On the Suggest Column Types, leave the default values and click OK. This will read the first 100 rows of the file and will determine the column type according to the data available in the file.

    Suggest column types

    Once you click OK on the Suggest Column Types dialog, you will notice that the data type on the flat file connection manager for the Column 0 has been changed to date [DT_Date]. Click OK to configure the flat file connection manager. You can also rename the column according to your requirements (say InvoiceDate or OrderDate etc.)

    Data type changed

    Now that you have the flat file connection manager configured, you can use it inside a Flat file source within a data flow task to read the data and populate your database. So, there is no need to manipulate values using a derived column transformation.

    However, if your incoming file values are in string like 120420 (YYMMDD), these values cannot be configured as date data types. In these scenarios, you need to use Derived Column transformation as suggested in this answer.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file in the following format: id,code,date,address,complete_url Example data from the
I have a csv file that looks like this: TEST 2012-05-01 00:00:00.203 ON 1
I have a .csv file that I turned into an SQLite database with the
I have a CSV file that goes something like this: ['Name1', '', '', '',
I have the following CSV file: Date,Av,Sec,128,440,1024,Mixed,,rule,sn,version 6/30/2010,3.40,343,352.0,1245.8,3471.1,650.7,Mbps,on,s-2.8.6-38,4.9.1-229,,vs. 342,-0.26%,-0.91%,1.51%,-0.97% 6/24/2010,3.40,342,352.9,1257.2,3419.5,657.1,Mbps,on,s-2.8.6-38,4.9.1-229,,vs. 341,0.23%,0.50%,-1.34%,0.67% 6/17/2010,3.40,341,352.1,1251.0,3466.1,652.7,Mbps,on,s-2.8.6-38,4.9.1-229,,vs. 340,7.77%,5.32%,9.04%,1.71% 6/14/2010,3.40,340,326.7,1187.8,3178.7,641.7,Mbps,on,s-2.8.6-38,4.9.1-229,,vs.
I have a CSV file that has data like this 15,I,2,41301888,BYRNESS RAW,,BYRNESS VILLAGE,NORTHUMBERLAND,ENG 11,I,3,41350101,2,2935,2,2008-01-09,1,8,0,2003-02-01,,2009-12-22,2003-02-11,377016.00,601912.00,377105.00,602354.00,10
I have a comma delimited file myfile.csv where the 5th column is a date/time
I have a column in a csv file called created with values: 2012-04-16 14:46:42
I'm supposed to add data from my csv file into my database. I have
I have a function that exports values into a CSV file, but the comments

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.