Reputation: 1
I am new to creating SSIS packages. I have a table on my database that has all the information I need. I am trying to create an SSIS package that will split the data by Department and then by Month based on a date range.
I am to create the package to split the data into separate excel spreadsheets by department....however, I don't know how to further the package to also conditional split by month based on a date range as well as the department. Any help is greatly appreciated.
SELECT
Department
, [Transaction Type]
, Quantity
, [Date/Time]
, CASE
when (cast([Date/Time] as Date) >= '2014-06-01' and cast([Date/Time] as Date) < '2014-07-01') then 'June'
when (cast([Date/Time] as Date) >= '2014-07-01' and cast([Date/Time] as Date) < '2014-08-01') then 'July'
when (cast([Date/Time] as Date) >= '2014-08-01' and cast([Date/Time] as Date) < '2014-09-01') then 'Aug'
when (cast([Date/Time] as Date) >= '2014-09-01' and cast([Date/Time] as Date) < '2014-10-01') then 'Sept'
when (cast([Date/Time] as Date) >= '2014-10-01' and cast([Date/Time] as Date) < '2014-11-01') then 'Oct'
when (cast([Date/Time] as Date) >= '2014-11-01' and cast([Date/Time] as Date) < '2014-12-01') then 'Nov'
when (cast([Date/Time] as Date) >= '2014-12-01' and cast([Date/Time] as Date) < '2015-01-01') then 'Dec'
else ''
END as Months
FROM [dbo].[DETAIL_DATA]
Basically, I would like to create an SSIS package that would put the data into an excel spreadsheet by department and by month. Is it possible?
Upvotes: 0
Views: 281
Reputation: 1915
You can try to use for loop or a foreach loop task, this will allow you walkthrough every department and every month to export them. You can start with one department and one month then try to generalise inside a loop for departments , keeping the month fixed; and finaly generalise the months in another loop.
The point is that as I see the request you need a loop instead of a conditional split.
Upvotes: 2