|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
本人新建的存储过程,
create procedure so_momo
@csocode nchar(20) ,
@cinvcode nchar(20)
as
SELECT DISTINCT
SO_SODetails.cSOCode AS 销售订单号, SO_SODetails.cInvCode AS 存货编码,
so_somain.ccusname as 客户 ,SO_SODetails.iQuantity AS 销售订单数量,
mom_order.MoCode AS 生产订单号, mom_orderdetail.Qty AS 生产数量, mom_morder.DueDate AS 生产完工日期
FROM SO_SODetails INNER JOIN
SO_SOMain ON SO_SODetails.ID = SO_SOMain.ID LEFT OUTER JOIN
mom_morder INNER JOIN
mom_orderdetail ON mom_morder.MoDId = mom_orderdetail.MoDId INNER JOIN
mom_order ON mom_orderdetail.MoId = mom_order.MoId ON SO_SODetails.cSOCode = mom_orderdetail.OrderCode AND
SO_SODetails.iRowNo = mom_orderdetail.OrderSeq
where so_sodetails.csocode = @csocode and so_sodetails.cinvcode = @cinvcode
ORDER BY 销售订单号
go
我想,如果我不带参数查询
exec so_momo 可以查出所有的行
如果带参数查询
exec so_momo '011005003', 'cbswi-jca0089a' 也就只可以查到指定的这一行
现在这个存储过程达不到这个效果,只能查带参数的,查不到所有, |
|