0

I have created an SSIS package which extracts data from an Excel file and outputs the results into a table in my database.

As this package will be run on a daily basis, I need to extract only those records which has been input on the day. Thus, I have added a Conditional Split in Data Flow.

When I run the "debug" in Visual Studio, my package runs fine and it shows as a "success". However, no records appear in my SQL Server Table.

I am assuming that I am doing something wrong at the "Conditional Split" level.

My "Condition" in the "Conditional Split Transformation Editor" looks as follows:

date == GETDATE()

"date" refers to a column in the Excel File where dates have been entered in the following format: 2021-06-24

I would appreciate some help to identify the problem.

user3115933
  • 4,303
  • 15
  • 54
  • 94
  • 2
    `GETDATE()` returns a `DT_DBTIMESTAMP`, so is accurate to 1/300th of a second. I *doubt* the data you are importing was generated at the exact time you tried to import it. Likely you need to convert the value to a `DT_DATE` before you compare. – Thom A Jun 24 '21 at 16:03
  • Data don't have time component in it. Only YYYY-MM-DD. I mean the date column has been formatted in Excel as such. – user3115933 Jun 24 '21 at 16:11
  • *"Data don't have time component in it."* But `GETDATE()` **does**. `2021-06-24 17:24:59:693` and `2021-06-24` are *not* the same value. – Thom A Jun 24 '21 at 16:25
  • @Larnu Thanks. date == (DT_DBDATE)(GETDATE()) did the trick! – user3115933 Jun 24 '21 at 16:31

1 Answers1

1

Thanks to "Larnu" for pointing me in the right direction.

This is what was needed in my case:

date == (DT_DBDATE)(GETDATE())
user3115933
  • 4,303
  • 15
  • 54
  • 94