Solved

SQL procedure call SSRS report

Posted on 2011-09-23
15
267 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:Jason Yousef, MS
ID: 36588441
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
ID: 36588445
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
ID: 36588490
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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 36588510
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
ID: 36588551
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:Jason Yousef, MS
ID: 36588652
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
ID: 36588700
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
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 36588799
can you explain more about the records and clients and how do you get their data?
0
 

Author Comment

by:vzorn
ID: 36588909
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:
Jason Yousef, MS earned 500 total points
ID: 36588946
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:Jason Yousef, MS
ID: 36588958
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
ID: 36589817
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:Jason Yousef, MS
ID: 36590409
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
ID: 36894016
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:Jason Yousef, MS
ID: 36894496
Great :)
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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