Search code examples
sqlexcelssisetltransformation

Ssis find row with max value in column


I need help with finding row with newest date in ssis. I have excel file and I need to find row with newest date in column "update_date" and then import that row in database. How can I find just that one row using ssis? For example I have a row with columns A, B, C and Update_Date and lets say my excel file looks like this:

T1, T1, T1, 1.1.2023
T2, T2, T2, 2.2.2023
T3, T3, T3, 3.3.2023

I need to find the third row and import only that row in database.

I tried using conditional split but cant use Max(date) as max cant be used in conditional splitting


Solution

  • Could you please try this and let me know if It solves your problem.

    You can query excel source by picking up sql command from Data Access Mode.

    SQL Command Source

    Here you can use Sheetname as Database table, enclosed in square brackets. Please do not forget to add a $ sign after sheet name, and you can also define a range if your data resides in certain cells in excel.

    Then create an OLE DB destination table to send that row to your table in dest db.

    I hope It solves your problem.