SHREERAAMAA 1 Reputation point

Good day,

I am using SSIS.

Data source is "Flat File Source"

Issue column name: [Years]

Data in this column [Years] shows only Years like 2000, 2010, 2011, 2021, 2222

Target is SQL Server table. In SQL Server target table [Years] column data type is "Date"

Can't move data from Flat File source to SQL Server target because of the Data type issue.

Please help

Thank you

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,490 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 25,386 Reputation points


    So you have missing month and day to make a year it into a legit date.
    How about (DT_DBDATE)(CONCAT([Year], "-01-01"))

    0 comments No comments

  2. SHREERAAMAA 1 Reputation point

    Thank you for your response.

    Basically, [Years] source column data type is [DT_STR] and would like to push this data as is to Target table, SQL Server target column data type is DATE.

    Thank you

  3. ZoeHui-MSFT 34,581 Reputation points


    If your source data format is yyyy-MM-dd and you want to convert it to DATE, you may add the Derived Column with below code.


    And then you may load it to SQL Server table.

    I would like to get YEAR from there.

    However I could not get the meaning of this, what result do you want to get? Could you please explain it with more details?



    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.