SQL While 循环
语法:
WHILE condition BEGIN {...statements...} END
例子:
DECLARE @Counter INT SET @Counter=1 WHILE ( @Counter <= 10) BEGIN PRINT 'The counter value is = ' + CONVERT(VARCHAR,@Counter) SET @Counter = @Counter + 1 END
测试结果如下:
参考网址:https://www.sqlshack.com/sql-while-loop-with-simple-examples/
本文来自博客园,转载请注明原文链接:https://www.cnblogs.com/keeplearningandsharing/p/15875055.html