我将这个存储过程传递给SSRS生成报表,但一直遇到“错误:数据类型nvarchar无法转换为int”,而我甚至没有使用任何nvarchar类型的参数。
Alter proc dbo.spPullOrderRosa1
@Subentity int,
@BegShipDate date,
@EndShipDate date,
@Store varchar(150),
@State varchar(150)
as
begin
select OpOrID as OrID, OpID, concat(OrCuFirstName,' ',OrCuLastName) as CustomerName,
b.SoName as StoreName,OpPrSKU as SKU, OpQty,StLongName as StateName,
cast(OpShipDate as date) as ShipDate,
cast(d.DeliveryDate as date) as DeliveryDate,
e.StyName as SubEntity
from csn_order..tblOrderProduct a with (nolock)
left join csn_order..tblOrder f with (nolock) on a.OpOrID = f.OrID
left join csn_order..tblStore b with (nolock) on a.OpSoID = b.SoID
left join csn_order..tblplState c with (nolock) on f.OrCuStID = c.StID
left join csn_order..tblDeliveryDate d with (nolock) on a.OpID = d.DeliveryOpID
left join csn_order.dbo.tblSubEntity e with (nolock) on b.SoStyID = e.StyID
where (OpCancelled = 0) and (b.SoID in (select SoID from csn_order..tblStore where SoName in (select * from STRING_SPLIT(@Store, ',')) ))
and (StID in (select StID from csn_order..tblplState where StLongName in (select * from STRING_SPLIT(@State, ',')) ))
and (StyID = @Subentity) and (OpShipDate >= @BegShipDate and OpShipDate <= @EndShipDate)
结束