I have a .bat file which renders SSRS reports in PDF format. The report accepts 2 parameters studentID and SubjectID. This runs fine when I try to pass in each studentID and SubjectID.
I would like the .bat file to execute a stored procedure which has list of studentID and SubjectID and run/loop through for each StudentID and SubjectID. Below is the .bat file code.
@setlocal enableextensions enabledelayedexpansion
@echo off
Set varServerPath=http://xyz/ReportServer
sqlcmd -Q "exec dbo.Storedproc_Studentlist" -S ServerName -d DatabaseName
LOOP:
rs -i C:\ReportRender\Student.rss -s%varServerPath% -e Exec2005 -v studentid="36" -v subjectid="500" -v vOutputFilePath="C:\ReportRender\Output\ZYZReport.pdf" -v vReportPath="/Student Reports/ReportName.rdl" -l 900
pause
exit
How can i loop through the "rs" Command for each results of the stored procedure
dbo.Storedproc_Studentlist
This stored proc returns
SELECT '1' AS RowNumber,'1789' StudentID, '364' SubjectID, 'C:\Reports\tmurray' OutputLocation
UNION ALL
SELECT '2' AS RowNumber,'1789' StudentID, '365' SubjectID, 'C:\Reports\tmurray' OutputLocation
UNION ALL
SELECT '3' AS RowNumber,'1780' StudentID, '364' SubjectID, 'C:\Reports\mdbrisbin' OutputLocation
Thanks,