如何在存储过程中使用循环 [英] how to use loop in stored procedure

查看:284
本文介绍了如何在存储过程中使用循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是usimg SQL Server Management Studio Express。如何在sql服务中使用存储过程中的循环管理Studio Exp.?

I am usimg SQL Server Management Studio Express. how to use loop in stored procedure in sql serve Management Studio Exp.?

推荐答案

请首先阅读您的问题的评论。



现在,我建议从基础开始:

WHILE(Transact-SQL) [ ^ ]循环用于重复执行SQL语句或语句块,只要指定的条件为真。可以与光标一起使用[ ^ ]。

CTE [ ^ ] - 公用表表达式可用作递归查询。在这意味着CTE表现为一个循环。



当你遇到困难时,请回到这里询问详细的问题。
Please, read comments to your question first.

Now, i'd suggest to start with basics:
WHILE (Transact-SQL)[^] loop is used to repeat execution of an SQL statement or statement block as long as the specified condition is true. Can be used with cursor[^].
CTE[^] - Common Table Expression can be used as recursive query. In that meaning CTE behaves as a loop.

When you get stuck, please come back here and ask detailed question.


这篇关于如何在存储过程中使用循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆