Solved

SQL procedure call SSRS report

Posted on 2011-09-23
15
264 Views
Last Modified: 2012-05-12
I have a SSRS report I need to run per client.
I would like to run a SQL procedure every hour to check which clients need the report run.
Then be able to run the report for each client and pass the @client parameter.
Possibly place the report in a folder specific to the @client parameter
Is this possible?
0
Comment
Question by:vzorn
  • 8
  • 6
15 Comments
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
Yes Possible, do you just need to use T-SQL and SSRS or you can involve SSIS too?

Also what do you mean by which clients need the report, can you explain how would you determine that?
0
 
LVL 28

Expert Comment

by:sammySeltzer
Comment Utility
Well, I *think* it is possible *IF* you can tell us *how* you can determine when a client needs report run.
0
 

Author Comment

by:vzorn
Comment Utility
Yes I can use SSIS too.
I am querying a linked server to determine if a client's team has been updated within the last hour.
If is has this client needs to have a report generated.  I can create a temporary table to store the clients to send to.  
I just cant quite figure out how to pass a parameter to the SSRS report and tell it where to save.
0
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
I was thinking about a central location and SSIS will rename and move or even e-mail ..

is there's a flag in a table on that linked server ?
0
 

Author Comment

by:vzorn
Comment Utility
For the table in the linked server I am looking for a record with a specific eventID within a specific time period.  It is a history/audit table.  It captures new events.  
0
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
Alright..
1-create your temp table
2-build your report on that table
3-schedule that report to render as pdf or XLS into a specific directory, also put the schedule as once so it creates the SQL agent job.
4-will create a SSIS package, schedule it every hour to run.

that package will run the SP to check if the flag is in, then will fire the sql agent job for the report, rename and move or email. per your requirement.

let me know which part you need help with?

0
 

Author Comment

by:vzorn
Comment Utility
I need help generating a separate report for each record.
If there are 4 clients who need the report I actually need 4 separate reports.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 21

Expert Comment

by:huslayer
Comment Utility
can you explain more about the records and clients and how do you get their data?
0
 

Author Comment

by:vzorn
Comment Utility
Well I could use a procedure to check for new records and store them in another table.
Then I could update each one as the report is sent out.
I could use a SELECT TOP 1 to pull just one record, create the report, then update that record?
But I would need to have the report renamed before I can get the next report run.
0
 
LVL 21

Accepted Solution

by:
huslayer earned 500 total points
Comment Utility
so store that in a temp table
use "foreachloop" container to do it one by one.

loop over the table, pull one row a time, create the report, rename and move, then process the second ...etc...
0
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
can you let me visualize what you'll bring to the temp table? is it information that will be in the report and one of the columns will be the client name for example?

can you share an example or screen shot? so I can be with you in the same page
0
 

Author Comment

by:vzorn
Comment Utility
Yes that process is what I need to do
"loop over the table, pull one row a time, create the report, rename and move, then process the second "
Temp table I would just store the ClientID, DateReportCreated.
I would inner join the data fields, it is quite a bit of data.  
Data fields would contain clientname, address, city, directions, phone, etc.
Cannot share screenshot sorry, sensitive information
0
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
Ok, let me know when you;re ready, when you're done, with the SP that populate the table, done built the report over the temp table...so we can take it to the next level...

0
 

Author Comment

by:vzorn
Comment Utility
This worked great.  Created the SSIS package to loop.
1. Checks for first open record and assigns variable.
2. Runs job to print report to folder  for first open record
3. Renames files to match variable
4. Updates record as completed.

Thanks for your help!
0
 
LVL 21

Expert Comment

by:huslayer
Comment Utility
Great :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now