Stored Procedure Returning Multiple Resultsset, Yet Reporting Services Only Uses The First Resultset Returned

Nov 9, 2007

Hi

I have written a stored procedure that returns 8 tables.

When I try to design a server report based on this stored procedure, reporting services only recognises the first table and not the other 7 tables.

I am using SQL Server 2005 and Visual Studio 2005.

Thank you in advance

Jav

View 4 Replies


ADVERTISEMENT

Transact SQL :: Store Resultsets Of Stored Procedure Returning More Than One Resultset In Two Different Table?

Apr 20, 2015

I have on stored procedure which returns mote than one resultset i want that to store in two different temp table how can achieve this in SQL server.

Following is the stored procedure and table that i need to create.

create procedure GetData as begin select * from Empselect * from Deptend 
create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
Insert into #tmp1 (Ddeptid , deptname ,Location )
exec GetData

create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
Insert into #tmp (empId,ename,deptId,salary)
exec GetData

View 9 Replies View Related

Use Resultset Returned From A Stored Procedure In Another Stored Procedure

Nov 15, 2006

I have a store procedure (e.g. sp_FetchOpenItems) in which I would like to call an existing stored procedure (e.g. sp_FetchAnalysts). The stored proc, sp_FetchAnalysts returns a resultset of all analysts in the system.
I would like to call sp_FetchAnalysts from within sp_FetchOpenItems and insert the resultset from sp_FetchAnalysts into a local temporary table. Is this possible?
 Thanks,
Kevin

View 3 Replies View Related

Reporting Services :: SSRS Report Does Not Display Resultset Through Dataset Returns Resultset

Oct 10, 2012

I am creating a simple SSRS table report through Report Builder. My dataset is looking for the stored procedure . When I execute the Stored procedure through SSMS I get resutset for certain parameters. I execute the dataset  (Store procedure) through query designer in dataset properties and I get results back. But when I try to run the report and see the preview, I do not get any results displayed. I been looking on the same issue form last 3-4 days and have not found any clue.

Following is the stored procedure I am using. Also I am passing multivalued parameter through report as well, and I am using spilt function to seperate the libraryid I am reading from parameter values. This works fine. I have similar kind of four other reports and with different stored procedure which exactly follow the same method , like multivalue parameters and other criteria are also very similar. All other reports works just fine.. This perticular report has issue for displying results, following is the stored procedure I am using 

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

[code]....

View 4 Replies View Related

SQL Reporting Services Issue Using Multiple Parameters Where Data Is Passed In From A Stored Procedure

Apr 15, 2008



I have an issue with using multiple parameters in SQL Reporting services where data is passed in from a stored procedure



When running the report in design mode - I can type in a parameter sting and it runs fine



In the report preview screen I can select single parameters by ticking the drop down list and again it runs fine



as soon as I tick more than one I get an error



An error occurred during local report processing

Query execution failed for data set €˜data'

Must declare the scalar variable '@parameter'



Some info...



The dataset 'workshop' is using a sproc to return the data string?

I get multiple values back fine in the sproc using this piece of code

(select [str] from iter_charlist_to_table( @Parameter, DEFAULT) ))



I have report parameters set to Multi-Value

Looking through the online books it says...



You can define a multivalued parameter for any report parameter that you create.

However, if you want to pass multiple parameter values back to a query, the following requirements must be satisfied:

The data source must be SQL Server, Oracle, or Analysis Services.
The data source cannot be a stored procedure. Reporting Services does not support passing a multivalued parameter array to a stored procedure.
The query must use an IN clause to specify the parameter.

Am I trying to do the impossible ?

View 1 Replies View Related

Returning Multiple Values From A Stored Procedure.

Feb 7, 2007

my stored procedure performs actions of deletion and insertion. Both the inserted and deleted items are output in temp tables with single column.
Is there a way to return the content of these two tables?
Is there a way to return a table from the stored procedure?

Thanks in advance
waamax

View 1 Replies View Related

Returning Multiple Rows From A Stored Procedure

May 22, 2006

Hi,I have the following stored procedure that does some processing andputs the result in a temporary table. I tried several things thatprocedure to display output that I can access with ADO.Net, but itdoesn't work. It doesn't even display the result in the query analyzerunless I add SELECT @ReturnFullNameAny help?The stored procedure:CREATE PROCEDURE sp_SEARCH_MULTIPLE_NAMES @search4fatherOfvarchar(255), @maximum_fathers int = 100, @ReturnFullName varchar(255)Output....SELECT @ReturnFullName = name FROM #FULLNAME------------------------------------------------To Execute the stored procedure:DECLARE @test varchar(255)EXEC sp_SEARCH_MULTIPLE_NAMES @search4fatherof='مريم',@returnfullname=@testPRINT CONVERT(varchar(255), @test)

View 5 Replies View Related

Stored Procedure Returning Multiple Rows

Oct 23, 2007

I have a stored procedure which return a single value and one which return multiple rows between two colums.
In my code for the procedure which returns a single value i use (executescalar) which works fine.
I am not sure what command to use in my code when i am calling the stored procedure that returns multiple rows between colums.
Any help would be appreciated.
Thanks.

View 3 Replies View Related

Can The OLE DB Command Transformation Support Multiple Values Returned By A Stored Procedure Or Is The Limit One Value Only?

Apr 10, 2007

I have no problem getting OLE DB Command transformations to support single returns by a procedure.

For example, exec name_of_procedure ?,?,? OUTPUT



However, I have a stored procedure which accepts 1 input and returns 5 outputs. This procedure works fine at the command line but when I try to incorporate it into a OLE DB Command I don't get the multiple values returned. There's no problem at all configuring the transform as it recognizes all input and output parameters. For some reason I just don't get values returned.



thanks

John

View 14 Replies View Related

Returning And Reading Multiple Select Statements From One Stored Procedure

Dec 3, 2006

Hey Guys. I’m having a little trouble and was wondering if you could help me out. I’m trying to create a custom paging control, so I create a stored procedure that returns the appropriate records as well as the total amount of records. And that works fine. What I’m having problems with is reading the data from the second select statement within the code. Anyone have any idea on how to do this? Also.. how can I check how many tables were returned?
Here's my code. I'm trying to keep it very generic so I can send it any sql statement:public DataTable connect(string sql)
{
DataTable dt = new DataTable();

SqlConnection SqlCon = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["MyDB"].ToString());
SqlDataAdapter SqlCmd = new SqlDataAdapter(sql, SqlCon);
System.Data.DataSet ds = new System.Data.DataSet();
SqlCmd.Fill(ds);

dt = ds.Tables[0];

//Here's where I don't know how to access the second select statement

return dt;
}  Here's my stored procedure:
 ALTER PROCEDURE dbo.MyStoredProcedure
(
@Page int,
@AmountPerPage int,
@TotalRecords int output
)

AS


WITH MyTable AS
(

Select *, ROW_NUMBER() OVER(ORDER BY ID Desc) as RowNum
From Table
where Deleted <> 1
)


select * from MyTable
WHERE RowNum > (((@Page-1)*@AmountPerPage)) and RowNum < ((@Page*@AmountPerPage)+1);

Select @TotalRecords = COUNT(*)
from Table
where Deleted <> 1
RETURN

Thanks

View 3 Replies View Related

SQL Server 2012 :: Create XML File From AS400 Stored Procedure Returning Multiple Datasets

Oct 3, 2014

I have a store procedure in MC400 which I can call from SSMS using the below command:

EXEC ('CALL GETENROLLMENT() ')At serverName

Now this command returns two data sets like:

HA HB HC HD HE
1112
112571ABC14
113574ABC16
114577ABC87
DADBDCDD
1115566VG02
1115566VG02
1115566VG02

I want to generate two different XML files from these two datasets.Is there any way this can be achieved in SSIS or t-sql ?

View 3 Replies View Related

Stored Procedure Returning 2 Result Sets - How Do I Stop The Procedure From Returning The First?

Jan 10, 2007

I hvae a stored procedure that has this at the end of it:
BEGIN
      EXEC @ActionID = ActionInsert '', @PackageID, @AnotherID, 0, ''
END
SET NOCOUNT OFF
 
SELECT Something
FROM Something
Joins…..
Where Something = Something
now, ActionInsert returns a Value, and has a SELECT @ActionID at the end of the stored procedure.
What's happening, if that 2nd line that I pasted gets called, 2 result sets are being returned. How can I modify this SToredProcedure to stop returning the result set from ActionINsert?

View 2 Replies View Related

Using Multiple Stored Procedures In One Report (SQL Server Reporting Services)

Aug 11, 2005

Hi all,

I want to use 2 stored procedures in one report, but I could not find what is the way of doing this. I searched this subject on the intrernet, and I found some solutions. However, they used stored procedures in one stored procedure and used in one report. This is not the thing which I want to do, I want only do using 2 stored procedures in one report at the same time.

Thanks, for now...

View 1 Replies View Related

CLR Stored Procedure In Reporting Services

Feb 24, 2007

Hi


I have created CLR Stored Procedure and my CLR stored procedures are not appearing in the Stored Procedures drop-down list located on the Data tab within the VS2005 Business Intelligence Development Studio. After Creating the dll I have registered the dll like that CREATE ASSEMBLY MY_SP_NAME from 'C:MY_DLL_PATHMY_DLL_NAME.dll' WITH PERMISSION_SET = SAFEAfter registering I have deployed the dll :CREATE PROCEDURE [dbo].[MY_SP_NAME] @dbname [nvarchar](4000), @varTable [nvarchar](4000), .............. .............. .............. ASEXTERNAL NAME [MY_DLL_NAME].[MY_CLASS_NAME].[MY_SP_NAME]GOEXEC sys.sp_addextendedproperty @name=N'AutoDeployed', @value=N'yes' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'MY_SP_NAME'GOEXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFile', @value=N'EXAMINER_WORKSHEET_F_hmz4_Ex.cs' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'MY_SP_NAME'GOEXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFileLine', @value=10 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'MY_SP_NAME'GOThe Stored Procedure is deployed successfully to SQL Server 2005, but its not showing in the drop-down list located on the data tab while I am desiging my RDL layout.All of the non-CLR stored procedures are present. Is there something I need to do to add these CLR stored procedures?
Please please ASAP.


Thanks
Tareqe

View 4 Replies View Related

Using Stored Procedure In Reporting Services

Apr 24, 2008



Hi all,I am using Stored procedure to design report instead of Query.
Problem is i am unable to view the fields in the dataset.
Any body please tell me the Steps to use Stored procedure in Reporting Services design.
Regards.

View 7 Replies View Related

Reporting Services Stored Procedure Dataset

Sep 26, 2004

I have a big SQL Stored Procedure which works with a cursor inside of it. During the procedure the data is inserted into a table and at the end is a SELECT statement from that table. The problem is that when i create a dataset with that stored procedure and i run it in the Data tab i get the correct select, but in the Fields section of the Report I don't get the fields from the last SELECT, but the fields from the cursor. Am I doing something wrong or is this a bug and how can i fix it.
Thanks!

View 3 Replies View Related

Reporting Services + Oracle Stored Procedure

May 14, 2008

Hello,
I'm having some problems and I wonder if anyone can help me.
I need to call a stored procedure to retrieve some data from the bank and use it in a report.
I'm using oracle DB, but I'm not using ODBC, I'm using Oracle.
I can call the SP using 2 commands:
1- in the dataset data form, I can select the command type as Stored Procedure and write the name of my procedure without the arguments, and then the VS ask for the arguments
2- in the same form, the command type as TEXT, i can use the syntax: call <SP name>(arguments)

My problems are:
-in the first way, how can I programatically set the arguments to send?
-in both of them, how can I define that the data that should be stored in the dataset is in the out cursor parameter?

Thank you,
Oscar

View 2 Replies View Related

Using Stored Procedure In Reporting Services(10th)

Mar 10, 2008

I have created stored procedure.How can i use it insted of writing Sql Statement in Report Design.

Pls Help me.

Regards.

View 1 Replies View Related

Stored Procedure Issues With Reporting Services

Jan 26, 2007

Hi all,

I have stored procedures that will run fine from query analyzer windows, from other programs, etc. When I try to run the sp from vs 2005 form with in a SSRS project, the sp just hangs. It will not return any records and the app says "Not Responding. This does not happen for all SP's only some of them. Any ideas?

View 8 Replies View Related

Stored Procedure With Resultset _

Jul 20, 2005

Hi,I would like to write a stored procedure that returns a resultset.e.g. select student_id, student_subject, subject_marksfrom student_resultswhere student_class_no = ?The input parameter is student_class_no (see ? as per above SQL).The output is a resultset, with each result consisting of student_id,student_subject, subject_marks.Can anyone advise how this is done in sql server stored procedure?Thanks,June Moore.

View 1 Replies View Related

Stored Procedure From SQL Server Reporting Services 2005

Dec 19, 2007

Hi,

I am working with one example on SQL Server 2005 Reporting Services. I have a stored procedure with two parameters. I want to call this stored procedure from SQL Server Reporting Services 2005.

CREATE PROCEDURE spEmp
(
@id int,
@name varchar(150)
)
AS
BEGIN
SELECT EmpId, EmpName, EmpSal FROM Emp WHERE EmpId = @id AND EmpName = @name
END

I want to pass

@id AND @name

parameters from reporting services form. Can you please give me link / article / steps to follow this in SQL SERVER REPORTING SERVICES 2005 ?

Thanks
Rajesh.

View 12 Replies View Related

Reporting Services :: Different Results In Stored Procedure And In Report

Oct 21, 2015

Created a report with parameters that can have multiple values.

Ran Stored procedure with same above criteria and data is retrieved

Ran the report and no data is displayed

I am unable to figure out where it might have gone wrong.

View 3 Replies View Related

Passing Null To Stored Procedure In Reporting Services

Jun 27, 2007

Hello,



I have a report. I need to make a drop-down parameter optional. I've setup the parameter to use a dataset as its source, and I need to allow the value to be null. I've selected allow nulls check box, and I've even tried setting the default value to System.DBNull.Value. But, when the entry is not selected (blank), no data ever comes back. If the data is blank or null, my procedure works (I've tested it). How do I send a null value to the database through reporting services report? I was hoping to avoid creating a special query just for that purpose.



Thanks.

View 15 Replies View Related

Reporting Services :: Calling Oracle Stored Procedure

May 2, 2006

I am trying to call oracle stored procedure from SRSS 2005. I am using the syntax  { Call s_test_rcur()} . I am getting following error.An error occurred while retrieving the parameters in the query.ORA-00911: invalid characterORA-06512: at "SYS.DBMS_UTILITY", line 68ORA-06512: at line 1

ORA-00911: invalid characterORA-06512: at "SYS.DBMS_UTILITY", line 68ORA-06512: at line 1 (System.Data.OracleClient)
Here is the Oracel stored proc.
TYPE rc_test IS REF CURSOR;
PROCEDURE s_test_rcur (po_test_rc OUT rc_test, -- returns a record setpo_error OUT INTEGER)ISBEGIN g_err_level := 1;OPEN po_test_rc FORSELECT a.ssn_id,TO_CHAR (a.acad_yr) || TO_CHAR (a.acad_yr + 1) acad_yr,RPAD (NVL (last_name, ' '), 30, ' ') last_name,RPAD (NVL (first_name, ' '), 30, ' ') first_name,NVL (middle_initial, ' ') middle_initialfrom test_tableorder by last_name;po_error := 0;EXCEPTIONWHEN OTHERSTHENpo_error := -1;g_error_code := SQLCODE;g_error_msg :='Err level :' ||TO_CHAR (g_err_level) ||' ' ||SUBSTR (SQLERRM, 1, 250);END;

View 2 Replies View Related

Reporting Services :: SSRS Not Loading The Stored Procedure?

Aug 21, 2015

I have a stored procedure (sproc)  running in Firebird Database. Now I try to use this sproc to build a report in the SSRS 2012 (SSDT) Report Designer.

After I connect to the dataset, and when I choose the Query Type as 'Stored Procedure', and type the name of  my sproc, and then go to the Query Designer, and click ! (F5)  ,   I get the following error:

TITLE: Microsoft SQL Server Report Designer
------------------------------

An error occurred while executing the query.
ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 1 [sproc name] 

ADDITIONAL INFORMATION:

ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 1 [sproc name] (OdbcFb)
------------------------------
BUTTONS:
OK
------------------------------

how to resolve this? If its a T-SQL sproc, then it will be no issue; in this case,  Firebird database connects to the SSRS via a 32-bit System ODBC connection.

When I proceed and click ok for everything, I get this error (after I exit the Query Designer), in the Dataset Properties tab:

"Could not update a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct."

The ODBC connection between SSRS and Firebird works fine. In fact I am able to run many queries as ad-hoc ones,  but when I use the queries as sprocs, then this issue pops up.

how to handle Firebird stored procedures  in SSRS.

View 2 Replies View Related

Suppess Resultset In Stored Procedure ?

Mar 14, 2006

I am try to execute a stored procedure via HTML using an XML template. The last statement in the procedure is a select stmt with FOR XML specified which will provide the output back to the calling program.
The problem is, the stored procedure I am calling in turn calls other procedures, which may also provide result sets.
So, I get this error message back
<?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to SQL Server" Description="Streaming not supported over multiple column result" ?>

I would really like a way to suppress all the resultsets produced during the execution of the procedure except the last one. Is there a way to do that within a procedure?

View 5 Replies View Related

Dynamic Use Of Stored Procedure Resultset

Oct 12, 2006

Hello,

I have a stored procedur like this:

--------------------------------------------
ALTER PROCEDURE dbo.pdpd_DynamicCall
@SQLString varchar(4096) = null
AS

create TABLE #T1
( column_1 varchar(10) ,
column_2 varchar(100) )

insert into #T1
execute ('execute ' + @SQLString )

select * from #T1
--------------------------------------------

The problem is that I want to call different procedures that can give back different columns.
Therefor I would have to define the table #T1 generically.But I don't know how.
Can anyone help me on this problem?

thank you
Werner

View 4 Replies View Related

Execute Stored Procedure In A Resultset[:D]

Feb 21, 2007

I have a sql server resultset that returns productid numbers. I would like to loop thru this resultset and run a stored procedure using the productid as the input parameter. Any samples would be helpful. thanks

View 3 Replies View Related

Weird Resultset From Stored Procedure

Jul 26, 2006

I have 2 stored procedures:

the 1st uses the second sp. to fill a parameter.
the 2nd has one output parameter defined.

When I run the 2nd sp. on its own in MS SQL Server Manangement studio, there is no resultset shown.

BUT when the 2nd sp. is executed inside the 1st sp., I get a '3' in the resultset everytime the 2nd sp. executes. What is causing this?????

This is the way I execute the 2nd sp. inside the 1st sp.:
select 'TEST1'
execute dbo.uspMonthlyHeadCount @soe, @eoe, @Months, @count output
select 'TEST2'

Results are like this:
TEST1
3
TEST2

... (it's displayed more times because the sp. is inside a while)
Why is this happening and what can I do about it? (I'll provide more info if needed!)

View 1 Replies View Related

Reporting Services :: SSRS Not Able To Load Results From Stored Procedure

Sep 9, 2015

I have created a query in which I have used first_value, lead, lag windows functions. I tried using the query in SSRS query text, but for some reason it could not load. Then I created a stored procedure and implemented that query in stored proc.

The problem is that I am able to execute the stoured proc from sql server studio, but SSRS is not able to load data.

View 5 Replies View Related

Why It Takes Forever To Execute Stored Procedure In Reporting Services?

Sep 17, 2007

I used a stored procedure in my report. If I run the sp in Management Studio (on my pc, database is on a sql server) it takes only several minutes; but from reporting services (also on pc) I put it in the data tab and execute it, it takes forever, actually never finish. I want to know why it's taking so long to execute it from reporting services while it returns data instantly from Mgt Studio. There is cursor in the sp. I don't know whether this is the culprit. Anyone knows why? Thanks!

Below is the sp.
--------------------------------------------------------------------

create proc [dbo].[p_national_by_week]

as

set nocount on



declare @s1 nvarchar(2000), @parmdefinition nvarchar(300), @rangestart smalldatetime, @rangeend smalldatetime

, @price_low money, @price_high money, @weekdate smalldatetime


declare c1 cursor for

--- GG change for reg dates.

select weekdate from vtRealEstate_RealtorListing_WeekDates

open c1

fetch from c1 into @weekdate



while @@fetch_status =0

begin

select @rangeend = @weekdate+7, @rangestart=@weekdate

select @s1 = N'

declare @mlsid_count int, @avg_price money, @avg_day_on_market int, @median_price money, @c1 int

select @mlsid_count=count(*), @avg_price=avg(CurrentPricefilter),

@avg_day_on_market=avg(datediff(dd, FirstListedDate, LastModifiedDate))

from vtRealEstate_RealtorListings

where ((FirstListedDate <= @rangeStart and LastModifiedDate >= @rangeStart) or

(FirstListedDate >= @rangeStart and FirstListedDate < @rangeEnd)

)

and currentpricefilter is not null

and mlsidfilter is not null

select @c1=@mlsid_count/2

set rowcount @c1

select @median_price = CurrentPricefilter from vtRealEstate_RealtorListings

where

((FirstListedDate <= @rangeStart and LastModifiedDate >= @rangeStart) or

(FirstListedDate >= @rangeStart and FirstListedDate < @rangeEnd)

)

and currentpricefilter is not null

and mlsidfilter is not null

order by currentpricefilter

insert report_detail_test (weekdate, mlsid_count, avg_price, median_price

, avg_day_on_market)

values(@weekdate, @mlsid_count, @avg_price, @median_price, @avg_day_on_market)

', @parmdefinition=N'@rangestart smalldatetime, @rangeend smalldatetime, @weekdate smalldatetime'



exec sp_executesql @s1, @parmdefinition, @rangestart=@rangestart, @rangeend=@rangeend

, @weekdate = @weekdate
fetch from c1 into @weekdate

end

select weekdate

, mlsid_count

, avg_price

, median_price

, avg_day_on_market

from report_detail_test

order by WeekDate

View 2 Replies View Related

Feed Stored Procedure With SELECT Resultset

Jul 20, 2005

I have two SQL Server stored procedures, PROC1 and PROC2. PROC1 hasabout 50 input parameters. PROC2 is the main procedure that does somedata modifications and afterwards calls PROC1 using an EXECUTEstatement.The input parameter values for PROC1 are stored in a table in mydatabase. What I like to do is passing those values to PROC1 using aSELECT statement. Currently, all 50 parameters are read and stored ina variable, and afterwards they are passed to PROC1 using:EXEC spPROC1 @var1, @var2, @var3, ... , @var50Since it is a lot of code declaring and assigning 50 variables, I waswondering if there is a possibility to run a statement like:EXEC spPROC1 (SELECT * FROM myTable WHERE id = 2)Any help on this is greatly appreciated!

View 1 Replies View Related

Reporting Services :: Unable To Display Time Difference Value From Stored Procedure

Nov 2, 2015

Created a report that displays the Maximum Response time (example of value 00:00:00) which is directly pulled from the Stored proc.When I ran the report, the column displays blank values.I am not sure if I should add any conversion to the Response value in the report.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved