Open report from stored procedure

Posted on 2011-10-08
Medium Priority
Last Modified: 2013-11-10
I was asked to provide a solution to launch an SSRS report from SQL Server 2008, without using SSIS.  I need to build the report string dynamically (that part I can handle) because I pass in parameters.  The Link is supposed to export the report to pdf...it looks something like this once the string is built:


Can I use xp_cmdshell or something to navigate to this link?   If so, what is the syntax?
Question by:PsychoDazey
  • 2
LVL 25

Expert Comment

ID: 36935436
In case if I got what you want to say, you can open any of the installed browser with the address passing to the exe. E.g.

"c:\Program Files\Mozilla Firefox\firefox.exe" www.google.com
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 36973267
How you'll be generating that link and the dynamic paramters?

Author Comment

ID: 36996925
I have parameters I will be passing in from a table variable.  It will grab the first row, pass in the 2 columns as parameters, and build the URL.
LVL 21

Accepted Solution

Jason Yousef, MS earned 2000 total points
ID: 36997208
Well, I wouldn't recommend using CMDSHELL for security issues in any production environment,I would use a temporary table and build my report over that table, using the 2 parameters in the report, create a scheduled rendered to pdf job for that report, let the SP truncate that table, enter the 2 parameters, and run the agent job.

but anyway...will give you the solution using xp_cmdshell too:
1-create a .bat file , enter that in the file

@echo off
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE "http://Servername/ReportServer?/MyReports/rpt17&rs:Command=Render&rs:Format=PDF&letterid=17&appid=5431"

Open in new window

2-then let the SP run  
EXECUTE xp_cmdshell 'C:\test.bat'

Open in new window


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

864 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