Open report from stored procedure

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 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?
Who is Participating?
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
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

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"
Jason Yousef, MSSr. BI  DeveloperCommented:
How you'll be generating that link and the dynamic paramters?
PsychoDazeyAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.