Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Repeating code over time period
Repeating code over time period
Rate Topic
Display Mode
Topic Options
Author
Message
prasan.dash83
prasan.dash83
Posted Wednesday, March 06, 2013 8:40 AM
Forum Newbie
Group: General Forum Members
Last Login: Friday, March 15, 2013 12:27 AM
Points: 6,
Visits: 7
Hi Guys,
I have a code snippet to run every month and have to take a union of current data and previous 11 months data and put in excel to prepare a report. I have to create a table with current month suffix and there are changes to be made to date variables.
Any suggestion how I can avoid making changes to the code and generate reports based on the current month,(it should automatically create a table based on the current month and take a union with the previous 12 months data only)?
Your help is appreciated!
Regards,
Prasanna
Post #1427460
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Wednesday, March 06, 2013 9:30 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 3:26 PM
Points: 31,425,
Visits: 13,738
Use SSIS to build a package. Base a query on dateadd to get the previous 11 months in your query.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1427492
Van Heghe Eddy
Van Heghe Eddy
Posted Sunday, March 10, 2013 8:23 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Thursday, March 28, 2013 9:55 AM
Points: 590,
Visits: 730
I agree with steve,
SSIS would be your best bet if you have the knowledge to use it.
Alternative if you don't have SSIS knowledge you can use a SP on the database level and SSRS as frontend witch can also be sheduled to run on certain timestamps and provide the data as needed.
Wkr,
Eddy
Post #1428984
Steven Willis
Steven Willis
Posted Sunday, March 10, 2013 6:30 PM
SSC Veteran
Group: General Forum Members
Last Login: Yesterday @ 7:19 AM
Points: 283,
Visits: 1,239
A partitioned view might be what you're looking for. Take a look at these links:
Using Partitioned Views
Modifying Data in Partitioned Views
Post #1429044
jaybrackett
jaybrackett
Posted Monday, March 11, 2013 11:24 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, April 17, 2013 7:26 AM
Points: 1,
Visits: 6
Have you considered just exectuing the query in Excel to begin with? You can create formulas in cells adjacent to the data set for formatting or other conditioning. I do this for several reports to get the 'Week Of' as the Monday date of that week and one for 'Day of Week' as well. These formula based values work very nicely in pivot tables and charts. Simply refresh the table and pivot data. from within the Excel report.
Post #1429413
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.