他们是一个更有效的方式吗?
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)
Run Code Online (Sandbox Code Playgroud)
干杯,-R
she*_*tie 20
我认为做一个查询就像你会得到它一样好:
select
@ShippingL = ShippingL,
@ShippingB = ShippingB,
@ShippingH = ShippingH,
@ShippingW = ShippingW
from
AuctionProducts
where
ProductID = @ProductID
Run Code Online (Sandbox Code Playgroud)
我想这比你发布的代码快4倍.此外,请确保在AuctionProducts表的ProductID列上定义了索引.