question

sathishkumar avatar image
sathishkumar asked

Designing Report in SSRS

Hi, I am trying to design a small report in SSRS in my stored procedure it will result two tables, but in SSRS if execut the procedure it will result only the first table .. below is my procedure create procedure dbo.sp_productiondailycount @report_date nvarchar(10) AS BEGIN DECLARE @tableName nvarchar(128), @schemaName nvarchar(128), @sql nvarchar(4000), @sql1 nvarchar(4000), @dateParam nvarchar(10) SET @dateParam = @REPORT_DATE DECLARE tc CURSOR FAST_FORWARD FOR SELECT name AS TableName -- uid AS SchemaName FROM sysobjects WHERE xtype = 'U' AND NAME NOT IN ('dtproperties') AND NAME IN('FLIR_MAINTENANCE_SEP_2011') OPEN tc FETCH NEXT FROM tc INTO @tableName WHILE (@@FETCH_STATUS = 0) BEGIN SET @sql = N'SELECT PR_NAME AS PR_NAME,PR_DATE as PR_DATE, COUNT(PR_DATE) AS PRTOTAL_COUNT FROM ' + '[' + @tablename +']' + N' WHERE PR_DATE = @innerdateparam GROUP BY PR_NAME, PR_DATE' SET @sql1 = N'SELECT QC_NAME AS QC_NAME, QC_DATE as QC_DATE, COUNT(QC_DATE) AS QCTOTAL_COUNT FROM ' + '[' + @tablename +']' + N' WHERE QC_DATE = @innerdateparam GROUP BY QC_NAME, QC_DATE' PRINT 'Production Report' PRINT @tablename EXEC sp_executesql @sql, N'@innerDateParam nvarchar(10)', @innerDateParam = @dateParam PRINT 'Quality Report' PRINT @tablename EXEC sp_executesql @sql1, N'@innerDateParam nvarchar(10)', @innerDateParam = @dateParam FETCH NEXT FROM tc INTO @tableName END CLOSE tc DEALLOCATE tc END And the result is like below > Production Report > PR\_NAME PR\_DATE PRTOTAL\_COUNT > Arun 10/12/2011 2 > Vijay 10/12/2011 6 > (2 row(s) affected) > Quality Report > QC\_NAME QC\_DATE QCTOTAL\_COUNT > Nalina 10/12/2011 96 > Sirish 10/12/2011 210 In SSRS if i execute the procedure it will show the first production report not the quality report.
ssrs
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
aRookieBIdev avatar image
aRookieBIdev answered
you can map a result set of the stored procedure to the report object.In your case the stored procedure internally executes two stored proc inside which means two different result sets.Hence you can not assign them to a single report object.only the first one is mapped to the report object.
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sathishkumar avatar image sathishkumar commented ·
can you tell me how to map a result set of the stored procedure to the report object
0 Likes 0 ·
sathishkumar avatar image sathishkumar commented ·
Hi..can u please tell me how to map result set..im new to SSRS...
0 Likes 0 ·
Fatherjack avatar image Fatherjack ♦♦ commented ·
you will need to split the procedure into 2 so that you can then get 2 report data tables to represent their results
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.