.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How do I call an SSRS Report from a stored procedure, and pass parameters?

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :Sql Server

Hi all,

I have a Report, that I want to run ad-hoc from a Stored Procedure. 

I want to render this report to PDF format, and save it to a drive.

The difference between this post and most threads I've seen is I don't want to run a stored proc within the report and send parameters to the stored proc.

I DO want to call a report FROM the stored proc, and send parameters TO the report.

How can I do this?

Many thanks,


View Complete Post

More Related Resource Links

can a Workflow access a stored procedure and pass the parameters from the list data to the stored pr

The reason that I would like to consider this functionailty is because my table architecture is complicated and I do not want to modify my master table to accept all of this data where some of the data should be normalized into sub tables.  Has anyone see evidence of the stored-procedure parm approach?  Is this best accomplished through VS 2010 or can I do it through SPD? Thanks

Adding parameters via URL to a SSRS report stored in Sharpeoint 2007

I am trying to pass parameter to a SSRS Report via URL stored in Sharepoint 2007 (integrated mode) but that doesn't seems to work. The report opens without the parameters taken into account. Any sggestions on how to pass parameters to SSRSreport on sharpeoint?..Thanks for your help...

Pass Multi-Value parameters to Stored Procedure problem



I am trying to pass multi-value parameters to stored procedure to filter data, but seems it does not work.

Stored procedure:


ALTER PROCEDURE [dbo].[test]

@StartDate DateTime,
@EndDate DateTime,
@FirstName varchar(8000),
@LastName varchar(8000),
@Location varchar(8000),

SELECT [Item No_],[Sales Staff],[Location Code],[Date],
[Price],[Quantity],[Item Category Code],[Product Group Code]FROM [Trans Sales Entry]
cte2 as
SELECT [ID],[First Name],[Last Name] FROM Sta

How to pass multivalued parameters to SSRS report hosted in ReportServer from ASP.Net page


I have a webpage from which Im passing parameters to a SSRS report.

While passing mutiple values from a multi valued parameters, the URL is exceeding the value of 2038 and hence the report is not showing up. Any suggestions on this matter would be really helpful.

eg: MacCode is a parameter and is multivalued attribute. Im choosing from the webpage drop down the values 1,2,3,4,5,6,7,8 for this MacCode. When it is passing to the ReportServer URL , it may exceed 2038 character limitation of URL.


Howto handle this... Please help


Call SQL Stored Procedure Asyncronously



I have a C# web page that calls a stored procedure. The page passes few parameters to the stored procedure and call it. The stored procedure does so many time consuming tasks on a huge number of database records but does not return any value.

Since the page is not expecting any return from the stored procedure, I want to execute the stored procedure asyncronously so that the user can continue working on the web page and other web pages while the stored procedure is running in the background. Also, I do not want the web server processes to be busy with the running stored procedure.

Any help, please.

Best regards,


stored procedure call to C#

Hi I created the Only stored procedure  for dynamically  I want to call that procedure in C# stored procedure CREATE   PROC SearchAndReplace ( @SearchStr nvarchar(100), @ReplaceStr nvarchar(100) ) AS BEGIN   -- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.   -- Purpose: To search all columns of all tables for a given search string and replace it with another string   -- Written by: Narayana Vyas Kondreddi   -- Site: http://vyaskn.tripod.com   -- Tested on: SQL Server 7.0 and SQL Server 2000   -- Date modified: 2nd November 2002 13:50 GMT   SET NOCOUNT ON   DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110), @SQL nvarchar(4000), @RCTR int   SET @TableName = ''   SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')   SET @RCTR = 0   WHILE @TableName IS NOT NULL   BEGIN   SET @ColumnName = ''   SET @TableName =     (   SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))   FROM INFORMATION_SCHEMA.TABLES   WHERE TABLE_TYPE = 'BASE TABLE'   AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName   AND OBJECTPROPERTY(   OBJECT_ID(   QUOTENAME(TABLE_SCHEM

How to export SSRS report to PDF from SSIS with parameters

Hello everyone.  I am trying to setup a process in which a user, who is using a vb.net 2008 application, will need to  trigger the creation of two items.  The first is  SSRS report which will need to be exported to PDF format to a shared folder on the network.  This report accepts one parameter.  The second thing that will need to be created at the same time is an excel file with data exported from SQL Server 2008 which is generated through an SSIS package.  A couple things to note.  The excel file and the pdf file need to have the same file name, other than the extension.  For example P00000001_20100831.pdf and P00000001_20100831.xlsx and will both be stored in the same network share.  The filenames need to be created dynamically at run time and will be based on a parameter being passed to the report. So far I have the portion that creates the excel file working fine.  The way I create that is as follows.  I have a stored procedure that creates a job which calls the SSIS package and passes the appropriate parameters to the SSIS package.  After the job is created I immediately run it and then delete the job.  Ok, everything works fine with that. Now I cant seem to figure out how to get the pdf created.  If possible I would like to keep this portion together with the already created job or package.&nb

how to pass dataset from one stored procedure to another stored procedure

I'm wondering how a dataset returned by a stored procedure can be passed to another stored procedure.     mark it as answer if it answered your question :)

Passing parameters from ASP.Net web page to SSRS report

I have a web page that displays some data.  The user first selects a date range on the web page and then can edit some data.  When they click a submit button, I want to run a report.  But I would like to pass the start date and end date values that the user already entered on the web page to the report.  Is this possible?  Can I use the value of a session variable in the report? Bob

Problems passing parameters to SSRS report from ASP.Net web page

I have a web page that displays some data.   When they click a submit button, I want to run a report.  But I would like to pass the start year/month and end year/month values that the user already entered on the web page to the report.  Here is what my url looks like when the report is displayed: http://xyzserver/Reports/Pages/Report.aspx?ItemPath=%2fReports%2fDevicesAllNew&rs:Command=Render&StartYYMM=201007&EndYYMM=201008 But my report displays the 2 textboxes for my StartYYMM and EndYYMM parameters as empty.  What am I doing wrong?  I did a google search and I saw something about using ReportServer instead of ReportManager.  I notice at the top of the browser when I run my report, it reads "Report Manager - Windows Internet Explorer".  Is this correct? Bob     Bob

New to WCF, how can i call a stored procedure via WCF?

Ok, i may be completely off track.  But i'm trying to get away from the old webservices, so i'm reading up on WCF.  I can't seem to get my head around what i'm doing wrong.  I'm attempting a simple call to a stored procedure on a sql server express. Here is my web.config <system.serviceModel> <services> <service behaviorConfiguration="ndfService" name="ndfService"> <endpoint address="http://localhost:8080/NDFService" binding="wsHttpBinding" contract="NDFService.IService" /> <host> <baseAddresses> <add baseAddress="http://localhost:8080/NDFService"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ndfService"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> </beha

SQL 2010 SP1 does not fill in Stored Procedure Parameters

I am executing a Stored Procedure in Server Management Studio.  The Procedure gives the expected results but it does not fill in the parameters?  I have stop and restarted the server to no avail. Please help? Thanks. STORED PROCEDURE USE   [char68003f] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SelectDonorXiD] ( @DonorID varchar(50) , @ContactTitle varchar(7)=null OUTPUT, @ContactFirstName varchar(40)=null OUTPUT, @ContactLastName varchar(40)=null OUTPUT, @ContactAddress1 varchar(40)=null OUTPUT, @ContactAddress2 varchar(40)=null OUTPUT, @ContactCity varchar(30)=null OUTPUT, @ContactStateCode varchar(2)=null OUTPUT, @ContactZipCode varchar(10)=null OUTPUT, @ContactPhone varchar(30)=null OUTPUT, @ContactEmail varchar(80)=null OUTPUT, @BillingTitle varchar(7)=null OUTPUT, @BillingFirstName varchar(40)=null OUTPUT, @BillingLastName varchar(40)=null OUTPUT, @BillingAddress1 varchar(40)=null OUTPUT, @BillingAddress2 varchar(40)=null OUTPUT, @BillingCity varchar(30)=null OUTPUT, @BillingStateCode varchar(2)=null OUTPUT, @BillingZipCode varchar(10)=null OUTPUT, @BillingPhone varchar(30)=null OUTPUT, @BillingEmail varchar(80)=null OUTPUT ) AS Select ContactTitle, ContactFirstName, ContactLastName, ContactAddress1, ContactAddress2, ContactCity, ContactStateCode, ContactZipCode, ContactPhone, ContactEmail, BillingTitle, Bil

Capture Stored Procedure Parameters in Trace

Hi, I want to capture each execution of all stored procedures and the parameters supplied, I'm going to do this via a trace on RPC:starting, capturing TextData, Database and starttime. I'll need to parse the TextData column to get the information that I want. I assume I also need to capture nested stored procedure calls , i.e. SP: starting as well. Does this sound correct and is this the best way of extracting this information ?Sean

Can I pass a value for a output variable in a stored procedure in ADO.NET?

I am calling a stored procedure, that exists in a SQL Server 2005 database,  using ADO.NET, in which I instantiate a sql command object.The stored procedure has an ouput variable like '@packageCode VARCHAR(100) = NULL OUTPUT'.Can I set it's value when creating the sql command object? Or I can never set a value for an output type variable in  a stored procedure?

call SSRS report in asp.net application

hi all I am using following code to call a report in a ap.net application but its output is " The request failed with HTTP status 401: Access Denied"........ kindly resolve..... ##############C O D E ################### Partial Class Report1     Inherits System.Web.UI.Page       Public Class ReportViewerCredentials1         Implements IReportServerCredentials         Private _userName As String         Private _password As String         Private _server As String         Public Sub New(ByVal userName As String, ByVal password As String, ByVal server As String)             _userName = userName             _password = password             _server = Server         End Sub         Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser             Get   &n

Cannot call Table Valued Function from Dynamic stored procedure statement

Hello,  I have a table-valued function that splits string into a table column. I can easily call this function from a stored procedure within a regular SELECT statement: SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM [dbo].[fnSplitValues](@Code2String))   However when I try to use the same logic for a dynamic SELECT statement: ‘SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM ' + [dbo].[fnSplitValues](@Code2String) + ')’ I get an error ‘Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnSplitValues", or the name is ambiguous.’ Any idea what is wrong with my dynamic SQL?   Please help, Lana

Pass parameter to Hidden Field in SSRS Report

Hi, I have Two Columns in a Table Say As Table1 Column1 = Text Column2= id My SSrs Report has two parameter values as Column1 and Column2. Column2 should be hidden SELECT DISTINCT COlumn1 FROM Table1. i have passed this query dataset to Column1 parameter. Now My requirement is that, when ever column1 drop is selected. the hidden field column2 should fecth the corresponding ID. this column2 has Storeprocedure which will Display the Output when View Report button is clicked Thanks, Saraswathy
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend