SQL CURSOR 同时选择多列值
时间:2011-05-23 来源:angel521
DECLARE @ofId int,@Amount decimal(18,2),@OrderID varchar(20)
DECLARE curOfId CURSOR FOR
SELECT lotOfId,lotWinMoney,t1.lotOrderID
FROM IP_OrderLottery AS t1 INNER JOIN View_OfficeInfo_CityCountry AS t2
ON t1.lotOfId=t2.ofId
WHERE t1.lotIsUpdateReward=0
OPEN curOfId
FETCH NEXT FROM curOfId INTO @ofId,@Amount,@OrderID
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @ofId
PRINT @Amount
PRINT @OrderID
FETCH NEXT FROM curOfId INTO @ofId,@Amount,@OrderID
END
CLOSE curOfId
DEALLOCATE curOfId
相关阅读 更多 +