在SSRS中,我只获得第一个表的结果集,而不是第二个表@ABC,是否有其他方法可以获取X_Q,Y_Q和Z_Q的值
IF OBJECT_ID('PrGetDetails') IS NOT NULL
BEGIN
DROP PROCEDURE PrGetDetails
END
GO
CREATE PROCEDURE PrGetDetails
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Details TABLE(SlNo INT,
X_A DECIMAL(15,2),
X_B DECIMAL(15,2),
Y_A DECIMAL(15,2),
Y_B DECIMAL(15,2),
Z_A DECIMAL(15,2),
Z_B DECIMAL(15,2),
INSERT INTO @Details (SlNo,
X_A,
X_B,
Y_A,
Y_B,
Z_A,
Z_B)
values (
(1,1.00,0.00,1.00,0.00,1.00,0.00),
(2,1.00,0.00,1.00,0.00,1.00,0.00))
DECLARE @ABC TABLE (
X_Q decimal(15,2),
Y_Q decimal(15,2),
Z_Q decimal(15,2)
)
insert into @ABC (
X_Q,
Y_Q,
Z_Q)
values (
3.00,
4.00,
5.00)
SELECT * FROM @Details
select * from @ABC
END
GO
答案 0 :(得分:2)
SSRS仅支持存储过程的第一个表格。
答案 1 :(得分:0)
您只需创建一个包含两个结果的宽表,然后创建一个可在报告中过滤的RecordType字段。
DECLARE @Details TABLE(
RecType varchar(7)
SlNo INT,
X_A DECIMAL(15,2),
X_B DECIMAL(15,2),
Y_A DECIMAL(15,2),
Y_B DECIMAL(15,2),
Z_A DECIMAL(15,2),
Z_B DECIMAL(15,2),
X_Q decimal(15,2),
Y_Q decimal(15,2),
Z_Q decimal(15,2)
)
INSERT INTO @Details (
RecType,
SlNo,
X_A,
X_B,
Y_A,
Y_B,
Z_A,
Z_B)
values (
('Details',1,1.00,0.00,1.00,0.00,1.00,0.00),
('Details',2,1.00,0.00,1.00,0.00,1.00,0.00)
)
insert into @Details (RecType
X_Q,
Y_Q,
Z_Q)
values ('ABC'
3.00,
4.00,
5.00)
任何结果集都会是这样的