他们是一种更有效的方法吗?
set @ShippingL = (select ShippingL from AuctionProducts where ProductID = @ProductID)
set @ShippingB = (select ShippingB from AuctionProducts where ProductID = @ProductID)
set @ShippingH = (select ShippingH from AuctionProducts where ProductID = @ProductID)
set @ShippingW = (select ShippingW from AuctionProducts where ProductID = @ProductID)
干杯, -R
答案 0 :(得分:20)
我认为做一个查询就像你得到它一样好:
select
@ShippingL = ShippingL,
@ShippingB = ShippingB,
@ShippingH = ShippingH,
@ShippingW = ShippingW
from
AuctionProducts
where
ProductID = @ProductID
我认为这比您发布的代码快4倍。此外,请确保在AuctionProducts表的ProductID列上定义了索引。