Solved

Stored procedure not working in Report

Posted on 2013-05-10
11
615 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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