在存储过程中使用for循环 [英] using for loop in stored procedure
本文介绍了在存储过程中使用for循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在存储过程中执行'for循环'
for(int i = 0; i< 4; i ++)
更新表
i want to perform this 'for loop' in stored procedure
for (int i=0;i<4;i++)
update table
推荐答案
DECLARE @Iterator INT
SET @Iterator = 0
WHILE (@Iterator < 4)
BEGIN
UPDATE
SomeTable
SET
SomeField = @Iterator
WHERE
AnotherField = SomeCritiria
Set @Iterator = @Iterator + 1
END
Hope 这个 [ ^ ]可能对您有帮助。
Hope this[^] might help you.
让我谷歌为你 [ ^ ]
这篇关于在存储过程中使用for循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文