How do I run an SSIS package for a specific date? - ssis

My server rebooted and failed to restart SQL last week which prevent the SSIS from running. When checking the reports SSRS I am missing data from Thursday and Friday. I have users who need the SSRS reports from those days.
How can I manually run the SSIS jobs in SSMS for a specific date (so the data populates in the SSRS)?
Thank you in advance.

You need to variable date in the source query and in the project paramters. When you run that every day, I assume it is scheduled job (or similar ptocess) so you can put today's date on the job. And that way you can run for old dates by giving the date.
So from here I would look where the data is coming,
case 1) if there is already that data in the source and your SSIS is limited to today's date only. That would be easier to resolve as you just have to select previous dates that you need.
case 2) the source has only today's date? I cannot imagine that is the case but if so, look for back up of that data or where does it go.

Related

MySQL Query or Excel 2010 - Which is the better way of arranging data for reports?

Info: Server version: 5.1.39 - MySQL / phpMyAdmin
Php: 5.4
Server: Apache
Code is run via: Server SQL Query (copy & paste in the phpMyAdmin) or in MySQL Workbench or using a custom shopping cart manager.
Exports to: Excel 2010 (.csv then to .xlsx for sales reports)
Hi there,
This is more a personal question, rather than a technical, however the answer should have a technical component.
Which is better? Run a full query (with calculations) in MySQL, export to Excel and work on that data OR Run a basic query and then run the calculations in Excel?
The scenario:
My sales reports are in MySQL from my online store, each month I export the data that I need and create reports in Excel with additional information. (Info not in the store).
My query has calculations, both for profit/loss & dates. I can do this in excel as well.
I am not an expert in either field, barely scraping by with help from people such as the community here and other sites, however I'd like to read some feedback from those that work with both.
I currently use things like (in addition to column calculations):
DATE_FORMAT(T5.date_purchased, '%Y-%m-%b') As OrdMonth,
DATE_FORMAT(T5.date_purchased + INTERVAL 1 MONTH, '%Y-%m-%b') As PayMonth,
concat(date_format(T5.date_purchased + INTERVAL 1 MONTH, '%y%m'), '-', T4.manufacturers_id) As RepID,
DATE_FORMAT(T5.date_purchased + INTERVAL 1 MONTH,'%y%m') As BatchID,
Which I can do in Excel with similar formulas.
So, is it better to have the report generate from the server as I want it in Excel, or just get the barest of info & run the calculations after?
Thank you in advance for your knowledge & input.
If the target user is any typical viewer of a web page, then use PHP+SQL.
If the target user is you, then get the data out as quickly as you can, then massage it with Excel.
Excel is more flexible, and functions + VBA will take you farther and faster than SQL.
In order to go more in depth with the answer I need more details.
EDIT
Here is the solution that I use very often: it is not professional, but when it's for personal use it's the fastest way:
Open both the csv file with the data to analyze and the Excel file with a VBA macro called CreateReport.xmls
Run the macro
Here is the description of the steps executed by the macro:
Scan all the open workbooks looking for the csv file (recognizing it for example by some header that is always there)
Add columns with formulas
For each report:
Duplicate the sheet
Delete the rows or columns that you don't need
Apply the formatting
If you don't know VBA there are many resources out there to get started. You can come back here when you have more specific questions.

what runs the subscribed report in SSRS?

so my question is, what runs the subscribed report in SSRS ? I mean when I subscribe to report and give it a desired time when it should run and send me the file. something does this right ? so I want to know what runs it ? is it a procedure in SQL function ? well the reason why I want to know this is that I want to run SQL update before each time this scheduled report starts.
I can just create procedure that will do the update I want before the scheduled time but, still it will be more practical to integrate it within the job itself
Short answer, these subscriptions are run as database jobs through the SQL Server Agent.
They are created with GUID type names:
The one job step will have a command like:
exec [ReportServer].dbo.AddEvent #EventType='SharedSchedule', #EventData='8df4ff30-97d3-41f7-b3ef-9ce48bfdfbfa'
You can trace these jobs/GUIDs back to the subscription and report through the ReportServer database using the Subscriptions table and its MatchData column (matches the job GUID) and the Catalog table which includes the report data (i.e. linked through the Subscriptions.Report_OID column.
You can use this information to check what's scheduled and based on this schedule your update appropriately.
I haven't tried it myself, but one option could even be to hook into the existing database jobs, but I would approach this with caution; I can't see any issues but maybe it's best not to update any system created jobs like these.

How do I generate daily reports in Microsoft Reporting Services 2008 R2?

I have the database in sql 2008. In this database daily some data is being inserted. I have to generate the report automatically without giving date i.e today is 10-10-2012. I have to view the report of 10-10-2012 on 11-10-2012 daily. It should happen automatically i.e Previous date entry should generate on current date without changing dates daily. Whether it is possible in SSRS report or we have to change in stored procedures please give the solution.
Yes, it is possible. I just did it.
Two options:
1 Specify the report parameters (dates) and give them default parameters. (Use a formula - hint, look for DateAdd in the formula editor)
2 set the query using DateAdd in SQL
When you've got the report, create a subscription.
How to do all this is covered in the documentation, available from Help on the SSRS website, or by pushing F1 in the Report builder.

How to make a scheduled report take holidays into consideration?

I have a report that is scheduled to be emailed out every Friday (weekly report. If the Friday falls on a holiday is there any way to make this report be emailed out on the Thursday instead, via having the holidays stored in a table or of a similar nature.
I guess the more appropriate question might be: is it possible to create a data-driven schedule in SSRS?
To be specific, all holidays would be user defined. Ideally stored in an SQL db. If the date that the report was meant to go out exists in this table than the report would be delivered a day earlier.
Reporting services cannot do that by default.
A workaround could be:
Create a table with holiday's
Create a weekly schedule for each report, setting Friday as the day to run
Create a scheduled task in SQL server agent to run on each week start, which will check if there is a holiday in this week. If it is, it will update the DaysOfWeek of the Schedule table on your report server from 32 (friday) to 16(thursday), otherwise it will set DaysOfWeek value to 32 (default)
Important: Backup before attempting any change on your report server database.

Package start and end times

I wanted to know if there is any system variable which is can use to access package execution start and end times. My requirement is that i need to store this in 2 relevant fields in a table in the database.
Why don't you enable logging via the SSIS menu? You could configure SSIS to log events to a SQL Server.
That way, you will not only have the start and end time it will be much easier to locate any errors.
http://msdn.microsoft.com/en-us/library/ms139845.aspx
There's a variable system::Starttime and why don't you just use a getdate() function when you're saving to the DB
Use the SQL Server 2012 SSISDB execution or execution_component_phases tables
Starting with SQL 2012 you can grab this information directly from catalog.execution or catalog.execution_component_phases tables within the SSISDB database using the start_time and end_time columns. The package is identified by the package_name variable. Knowing this can really come in handy. (Kind of surprised nobody at all mentioned this since OP/June 2017).
https://learn.microsoft.com/en-us/sql/integration-services/system-views/catalog-execution-component-phases
Note:
This should save you the step of having to use a system variable, since the data is already in a table.