2017-01-19 57 views
0

我有一個在sql管理工作室工作的查詢,但是當我運行這個SSRS/Visual Studio時,出現錯誤「無法讀取數據集dataset1的下一個數據行。錯誤的數據類型爲nvarchar轉換爲數字」無法讀取數據集的下一個數據行

select 

    concat(
    right(replace(oe_hdr.po_no, '-', ''),8), 
    right(concat('000',job_price_line.line_no),3), 
    format(oe_pick_ticket_detail.unit_quantity, '00000000'), 
    cast(job_price_line.customer_part_no as char(20)), 
    oe_pick_ticket.invoice_no) as [po/line/release/qty/cust part no as 20 characters/invoice] 




    from oe_pick_ticket 

join oe_pick_ticket_detail on oe_pick_ticket_detail.pick_ticket_no = oe_pick_ticket.pick_ticket_no 
join oe_hdr on oe_hdr.order_no = oe_pick_ticket.order_no 
join job_price_hdr on oe_hdr.job_price_hdr_uid = job_price_hdr.job_price_hdr_uid 
join job_price_line on job_price_line.inv_mast_uid = oe_pick_ticket_detail.inv_mast_uid and job_price_line.job_price_hdr_uid = oe_hdr.job_price_hdr_uid 
join ship_to on ship_to.ship_to_id = oe_hdr.address_id 
join branch on branch.branch_id = ship_to.default_branch 
join customer on customer.customer_id = oe_hdr.customer_id 

where oe_pick_ticket.invoice_no in ('1218972', '1218983') 
and job_price_line.row_status_flag != '705' 
and oe_pick_ticket_detail.ship_quantity > '0' 

enter image description here

但是當我運行本作SSRS - 我增加更多的參數,我的where子句是這樣的:

where oe_pick_ticket.invoice_no in (@invoiceno1, @invoiceno2, @invoiceno3, 
    @invoiceno4, @invoiceno5, @invoiceno6, @invoiceno7 ,@invoiceno8, 
@invoiceno9, @invoiceno10, @invoiceno11, @invoiceno12, @invoiceno13, 
@invoiceno14, @invoiceno15, @invoiceno16, @invoiceno17, @invoiceno18, 
@invoiceno19, @invoiceno20) 
     and job_price_line.row_status_flag != '705' 
     and oe_pick_ticket_detail.ship_quantity > '0' 

它返回錯誤

enter image description here

+0

檢查表中的'invoice_no','row_status_flag'和'ship_quantity'類型,並確保您使用的是SAME類型的參數,並且正確填寫這些參數。 –

+0

「oe_pick_ticket.invoice_no」的數據類型是什麼? –

+0

看來你的數據集正在返回一個nvarchar值,但是在處理數據時,它正試圖對它執行算術運算,這會導致錯誤。嘗試在使用該列的表達式中使用CDBL(Fields!YourField.Value)。 –

回答

0

我發現我不得不讓我所有的參數的空表達式。這解決了我的問題。