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 7850335
In Process

The Archive Base Latest Questions

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

I have an input text file, which consists of few columns namely TransactionID ,

  • 0

I have an input text file, which consists of few columns namely TransactionID, receiveddt, description etc. The recieveddt column has date value in the following format 120419 (yymmdd). I would like to load the .txt input file into a database but the destination column recieveddt is of data type DateTime. I used the derived column transformation to convert the incoming receiveddt column value to datetime as shown below

Derived Column Name  Derived Column     Expression            Data Type 
-------------------  -----------------  --------------------  ---------
receiveddate         replace reciveddt  (DT_DATE)[reciveddt]  datetime 

I tried different combinations but I keep gettings errors while attempting to perform a type cast.

How can I convert string (YYMMDD) to datetime using derived column transformation?

  • 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-02T18:48:48+00:00Added an answer on June 2, 2026 at 6:48 pm

    Expression:

    (DT_DATE)("20" + SUBSTRING([ReceivedDt], 1, 2) + "-" + SUBSTRING([ReceivedDt], 3, 2) + "-" + SUBSTRING([ReceivedDt], 5, 2))
    

    For readability:

    (DT_DATE)("20" + 
        SUBSTRING([ReceivedDt], 1, 2)  + "-" + 
        SUBSTRING([ReceivedDt], 3, 2)  + "-" +
        SUBSTRING([ReceivedDt], 5, 2))
    

    Cause of the issue:

    You cannot convert string in format YYMMDD to valid date value. Use the above expression to prefix the value with 20 to convert the values to format YYYYMMDD that could be converted to dates.

    SSIS 2012 package that illustrates the above given expression:

    Configure the Data Flow Task with a OLE DB Source, Derived Column Transformation and two Multicast Transformations.

    Data Flow Task

    Configure the OLE DB Source with the following query that has the values in format YYMMDD.

    SELECT  '120304' AS ReceivedDt UNION
    SELECT  '120107' AS ReceivedDt UNION
    SELECT  '121211' AS ReceivedDt UNION
    SELECT  '121312' AS ReceivedDt;
    

    Configure the Derived Column Transformation to convert the incoming value in column ReceivedDt in format YYMMDD to ReceivedDate of format YYYYMMDD.

    Derived Column Transformation

    Attach data viewer between the Derived Column Transformation and the Multicast Transformations. Configure the Error Output to Redirect row instead of Fail component.

    Executing the package will display the string values that could be converted to valid date values in the data viewer between Derived Column Transformation and the success Multicast Transformation.

    Success Multicast Transformation

    Executing the package will display the string values that could not be converted to in the data viewer between Derived Column Transformation and the error Multicast Transformation.

    Error Multicast Transformation

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

Sidebar

Related Questions

I have a text file,which I use to input information into my application.The problem
I have an input text file which I am reading and storing everything in
I have an input text file which is well structured: START_PARAMETERS C:\Users\admin\Desktop\Bladed_wind_generator\_wind C:\Users\admin\Desktop\Bladed_wind_generator\reference_v_4_2.$PJ END_PARAMETERS
I have a text file input which contains data as below. How can I
I have a text file (c:\input.txt) which has: 2.0 4.0 8.0 16.0 32.0 64.0
I'm trying to read a file text(input.txt) which consists of multiple line like A
I have a text file which is a 1000 Row * 40001 Column table.
I have a linux utility that parses structured input ( a text file ),
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
I have two input text boxes which are decimal. The sum of the two

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.