Solved

Stored procedure not working in Report

Posted on 2013-05-10
11
606 Views
Last Modified: 2016-02-11
I'm looking for ideas as to why executing a certain stored procedure as a dataset does not work in a SSRS Report.

By does not work, I mean no data is returned.

In BIDS by going into the Shared Dataset Properties -> Query ->  Query Designer -> ! (which runs the query). The column headers appear and data appear.

However, in the report itself, no data is returned. This stored procedure should return one row of data, no more no less. The dataset 'knows' the columns returned by the sproc in that the fields in the dataset properties are shown correctly. It has ` parameter, and I've tried hard-coding it, but makes no difference. When I look in SQL Server profiler on the database/server, indeed nothing happens when running the report.

I have another dataset in the same report, running another sproc and it runs correctly. This is sproc returns many rows. Is there something special about calling an sproc that returns only 1 row?
0
Comment
Question by:allelopath
  • 5
  • 4
  • 2
11 Comments
 
LVL 13

Accepted Solution

by:
jonnidip earned 500 total points
ID: 39155389
Please make sure you don't have a local .rdl.data file, that stores a cached version of your previous request.
That file is found in your VS project folder and is safe to delete.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39155404
Five bucks says ...

(1)  You don't have SET ANSI_WARNINGS OFF, such that it's thinking (1 rows returned) is the return recordset.
(2)  You have a troubleshooting-like SELECT statement before the final return recordset, and that's what SSIS is interpreting.  Even if it's in an IF block, SSIS will interpret the first SELECT.
(3)  Something else that gets me out of paying five bucks.

>Is there something special about calling an sproc that returns only 1 row?
Nope.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39155453
(4)  It is returning a row, but in the table / matrix that populates it the detail section was deleted, so no rows are displayed.
(5)  It is returning a row, but the detail section's Hidden property is set to True.
0
 
LVL 1

Author Comment

by:allelopath
ID: 39155560
@jonnidip:
The only rdl file I see is in Solution Explorer -> Reports. This certainly has to exist, so I'm not sure where you are saying to look.
0
 
LVL 13

Assisted Solution

by:jonnidip
jonnidip earned 500 total points
ID: 39155567
"<yourRDL>.rdl.data" is a file that is created when you test the report in VS.
You have to look for this file in the FOLDER, not in the project.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:allelopath
ID: 39155587
@jimhorn:
ANSI_WARNINGS is not in the sproc. Fwiw, there is:
USE [MyDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [reports].[uspCoverSheet]
@MyNumber varchar(10) = '0000000000'
AS
BEGIN
	SET NOCOUNT ON;

select top 1 [MyId]
...

Open in new window

0
 
LVL 1

Author Comment

by:allelopath
ID: 39155601
@jonnidip:
Do you mean:
C:\Word\Visual Studio 2008\Projects\MyProject\MyProject\MyProject.rdl
This folder also has the .rsd, .rds, .data, .rptproj, and .user files
0
 
LVL 13

Expert Comment

by:jonnidip
ID: 39155676
The .data file is what I mean.
You can try to delete or rename it and test your report again.
0
 
LVL 1

Author Comment

by:allelopath
ID: 39155719
I deleted the .data file, then went to Preview tab, and this shows:
An error occurred during local report processing
An error occurred during report processing
An attempt was made to set a data set parameter '@MyNumber' that is not defined in this data set.
0
 
LVL 13

Expert Comment

by:jonnidip
ID: 39155751
Your dataset (from stored result) may not match your actual report schema.
Would you please check if your stored returns MyNumber field?

You may also check if the profiler does now show your stored execution.

Please note that the .rdl.data file is created when you test your project and the file itself is missing. If you want to have fresh data at a test execution you will need to delete the file again.


Regards.
0
 
LVL 1

Author Comment

by:allelopath
ID: 39155899
YES, the .data file was indeed the problem. Thanks.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
My client has a dictionary table. They're defining a list of standard naming convention. Now, they are requiring my team to provide us a mechanism how to match new incoming data with existing data in their system.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now