|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: 2 days ago @ 11:37 AM
Points: 220,
Visits: 543
|
|
I have a pacakge that pulls the data from the table for a month. It runs on the first of the month and it pulls the previous month of data.
Requirement is to generate files for June 2011 to present but broken them weekly based on the transaction date. How can I run it in a loop per week for that time period?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 6:22 PM
Points: 1,336,
Visits: 4,023
|
|
[sarcasm]Simply set the date bucket parameter to weekly and the range filter from June 2011 to today.[/sarcasm]
Sorry, feeling a bit  
Truly...
Create a dates table (with weeks in it) Add a data flow to grab the weeks from the dates table for the required range and feed that into a package variable (recordset destination) use a foreach loop to loop through the weeks in the variable feed the start and end dates from the week into your extract routine (where clause) output to file (use expression to build file name using week number from loop)
If I have assumed too much knowledge and Google doesn't help , then ask questions by all means
MM
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: 2 days ago @ 11:37 AM
Points: 220,
Visits: 543
|
|
| Thanks. Another question. I have a for each container that reads dates from the table. Inside the container, I've execut SQL task. I did the parameter mapping and seems like I can't access date variable in execute SQL task. Getting syntax error or access violation error. Any idea?
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 2:19 PM
Points: 4,324,
Visits: 9,665
|
|
mister.magoo (2/20/2013)
[sarcasm]Simply set the date bucket parameter to weekly and the range filter from June 2011 to today.[/sarcasm] Sorry, feeling a bit   Truly... Create a dates table (with weeks in it) Add a data flow to grab the weeks from the dates table for the required range and feed that into a package variable (recordset destination) use a foreach loop to loop through the weeks in the variable feed the start and end dates from the week into your extract routine (where clause) output to file (use expression to build file name using week number from loop) If I have assumed too much knowledge and Google doesn't help , then ask questions by all means
Alternatively, add a Conditional Split in the data flow and split the data into four streams - to four separate files.
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 6:22 PM
Points: 1,336,
Visits: 4,023
|
|
Phil Parkin (2/21/2013)
Alternatively, add a Conditional Split in the data flow and split the data into four streams - to four separate files.
I like this idea, but only if every month has four weeks in it
MM
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 6:22 PM
Points: 1,336,
Visits: 4,023
|
|
SQL_Surfer (2/20/2013) Thanks. Another question. I have a for each container that reads dates from the table. Inside the container, I've execut SQL task. I did the parameter mapping and seems like I can't access date variable in execute SQL task. Getting syntax error or access violation error. Any idea?
Can you explain how you are trying to use the variable?
I was thinking that your existing routine would have a date range that it pulled and you would be replacing an existing set of variables with those from the loop (or calling your existing package from a new one and passing in the variables values to existing variables in the original package)...
Are you calling a SP or just using a query ?
More info please?
MM
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 2:19 PM
Points: 4,324,
Visits: 9,665
|
|
mister.magoo (2/21/2013)
Phil Parkin (2/21/2013)
Alternatively, add a Conditional Split in the data flow and split the data into four streams - to four separate files.I like this idea, but only if every month has four weeks in it 
Well, I did give that some thought.
And there has to be a prior step to set up variables containing the 'break dates' for the month too.
But thought it worth a mention nonetheless.
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: 2 days ago @ 11:37 AM
Points: 220,
Visits: 543
|
|
| I have a table which stores date per week. I am passing those dates to my inline statement (in execute sql statement).
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 6:22 PM
Points: 1,336,
Visits: 4,023
|
|
SQL_Surfer (2/21/2013) I have a table which stores date per week. I am passing those dates to my inline statement (in execute sql statement).
How? Show us please 
What error are you getting? Show us the exact error please
MM
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: 2 days ago @ 11:37 AM
Points: 220,
Visits: 543
|
|
| It worked after converted inline statments to stord proc. thanks for your help.
|
|
|
|