我有一个在sql management studio中运行的查询,但是当我运行它是SSRS / Visual Studio时,我得到错误“无法读取数据集数据集1的下一个数据行。将数据类型nvarchar转换为数字时出错”< / p>
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'
但是当我为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'
它返回错误
答案 0 :(得分:0)
我发现我必须在所有参数上允许空表达式。这解决了我的问题。