首页 > 代码库 > sqlserver循环

sqlserver循环

sql循环,除了游标还有如下

 

     --   --创建临时表			         --   DECLARE @tradeID INT;            --if not object_id(‘Tempdb..#A‘) is null            --     drop table #A            --Create table #A([TradeID] nvarchar(100))            --Insert #A SELECT TradeID FROM dbo.CRM_AntiFakeQRec GROUP BY TradeID            --WHILE EXISTS(SELECT TradeID FROM #A)            --BEGIN            --SET ROWCOUNT 1            --SELECT @tradeID=TradeID FROM #A            --SET ROWCOUNT 0            --DELETE FROM #A WHERE TradeID=@tradeID            --PRINT @tradeID

  

sqlserver循环