SQL Reporting Services Problem
Hi Scholars,
I have a problem with SSRS. I tried to generate a report using "Dynamic Stored Procedure" as my input query.
I could see parameters in my "Report Data" which came from stored proc, but not the columns in the dataset, to display the report. Please help me. Thanks in advance. My stored proc looks like below
USE
[AURA_DDW]
GO
/****** Object: StoredProcedure [dbo].[Tag_List_URL] Script Date: 11/23/2010 10:45:57 ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
ALTER
PROCEDURE [dbo].[Tag_List_URL]
(
@AcctAffinityID
varchar(200),
@ProductGroup
varchar(30),
@UserName
varchar(50),
@CurrentLevelAcctID
varchar(200),
@AcctLinkNum
varchar(10),
@AcctCustNum
VARCHAR(200),
@TagInvFiscalTime
varchar(10)
)
AS
DECLARE
@wherecon varchar(2000)=''
DECLARE
@sql nvarchar(2000);
IF
@ProductGroup is
NOT
NULL
BEGIN
set
@wherecon=@wherecon+
' and (GROUP_DESC='+''''+
@ProductGroup+''''+'
OR
TYPE_DESC='
+''''+
@ProductGroup+''''+'
OR
BRAND_DESC='
+''''+
@ProductGroup+''''+'
OR
PRODUCT_DESC='
+''''+
@ProductGroup+''''+'
) '
+'';
END
if
@AcctLinkNum is
not
null
begin
set
@wherecon=@wherecon+'
and [Acct Link Num]='+''''+@AcctLinkNum+''''+''
end
if
@AcctCustNum is
not
null
begin
set
@wherecon=@wherecon+'
and CUSTOMER_NUM='+''''+@AcctCustNum+''''+''
end
if
@TagInvFiscalTime is
not
null
begin
set
@wherecon=@wherecon+'
and (FISCAL_YEAR='+''''+@TagInvFiscalTime+''''+'
or
FISCAL_QUARTER='
+''''+@TagInvFiscalTime+''''+'
OR
FISCAL_MONTH='
+''''+@TagInvFiscalTime+''''+'
)'
+'';
end
SET
@SQL='SELECT
* from dbo.View_Aura_Rptg_Tag_Detail where [Acct Pty ID]='+''''+@AcctAffinityID+''''+
@wherecon
--select @sql; --(To see the SQL statement in output)
--To run SQL Statement dynamically use sp_executesql
exec
sp_executesql
@sql
November 23rd, 2010 10:29am