SSIS -Using max function in importing excel data

Hapr1

Registered User.
Local time
Today, 06:05
Joined
Aug 4, 2005
Messages
24
I have a problem.
I need to design a simple SSIS package, wherein I use an input excel source and an output SQL server table. All I need to do is to import data from excel to SQl server table by using a check condition on date column in excel sheet.

In the package, I have an excel source wherein I use a sql statement to pull data from excel sheet. I have a date column in the excel sheet so I want to use the statement
Select * from sheet1 ( excel spreadsheet)
where date>(select max(date_val) from [sql server name].[table name])

so I need to only import data which is greater than the max date in the sql server table.

can this be done?

right now, I use a variable and type in the date value.. is there a way to automate the process?
Please help..
I am new to SSIS and finding examples online is hard and i am stuck...
Thanks
 
Hello,

In DTS and SSIS I always find it easier to load the data into an interim table that is created and dropped on the fly. Then you can use an 'execute sql task' to load the data into to your target table, like so:

Code:
insert into target_table
Select * from interim_table
where date>(select max(date_val) from [sql server name].[table name])
 

Users who are viewing this thread

Back
Top Bottom