2015-05-26 95 views
-1

執行此過程後,在我的結果集中,只有2個字段,我無法找到該錯誤。我只拿到S1中沒有和TypeofDocument在我的ResultSet結果集中缺少的字段

我的代碼:

IF OBJECT_ID('PrGetDetails') IS NOT NULL 
    DROP PROCEDURE PrGetDetails 
GO 

CREATE PROCEDURE PrGetDetails 
AS 
BEGIN 

    SET NOCOUNT ON; 


    DECLARE @ReportDetails TABLE(
     SlNo INT, 
     TypeOfDocument NVARCHAR(150), 
     Supplier NVARCHAR(150), 
     CodeNo NVARCHAR(150), 
     ReceivedDate Date, 
     ST_C DECIMAL(20,2), 
     ST_D DECIMAL(20,2), 
     EC_C DECIMAL(20,2), 
     EC_D DECIMAL(20,2), 
     HC_C DECIMAL(20,2), 
     HC_D DECIMAL(20,2) 
    ); 

    INSERT INTO @ReportDetails (SlNo, 
    TypeOfDocument, 
    Supplier, 
    CodeNo, 
    ReceivedDate, 
    ST_C, 
    ST_D, 
    EC_C, 
    EC_D, 
    HC_C, 
    HC_D) 
    values 
    (1,'A','S1','AAJF7LSD01','2014/04/04',4362.00,0.00,87.00,0.00,44.00,0.00), 
    (2,'B','S2','AAJFV87LSD1','2014/04/04',2520.00,0.00,50.00,0.00,25.00,0.00), 
    (3,'C','S3','AK6009T001','2014/04/08',10498.00,0.00,210.00,0.00,105.00,0.00), 
    (4,'D','S3','AJ6009LST1','2014/04/16',45723.00,0.00,914.00,0.00,457.00,0.00), 
    (5,'E','S4','AAKPK8983001','2014/04/16',171.00,0.00,3.00,0.00,2.00,0.00), 
    (6,'F','S5','AKIPM8938P001','2014/04/16',14952.00,0.00,299.00,0.00,149.00,0.00), 
    (7,'G','S6','AKIPM8938P001','2014/04/16',28849.00,0.00,577.00,0.00,288.00,0.00), 
    (8,'','S7','AABCA7375CST042','2014/04/23',60000.00,0.00,1200.00,0.00,600.00,0.00), 
    (9,'','S8','AABCA7375CST042','2014/04/23',1482.00,0.00,30.00,0.00,15.00,0.00), 
    (10,'','S8','AABCA7375CST042','2014/04/29',250800.00,0.00,5016.00,0.00,2508.00,0.00) 

    SELECT * FROM @ReportDetails 
END 
GO 
+1

其中2個?爲什麼插入中的列與聲明它的名稱不同? – loli

+0

修復@ user3468982提到的錯誤後,將返回所有列。您可能會在您的SSRS中獲得緩存結果。 – ughai

+0

我刷新本地緩存,但無法得到它 – Kavr

回答

0

請去你的項目文件夾,刪除文件xxxx.rdl.data。然後再次檢索數據。當我用你的程序進行測試時,它可以正確地返回所有的字段和記錄。

enter image description here