存储过程中的循环 [英] loops in stored procedure

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

问题描述

大家好......

我在一个进程中有两个表,这些表分别属于主实例和辅助实例,
我将同时为中学和中学做该过程
次要内容来自table2,主要内容来自table1,

i''v选择与两个表的实例相关的值.........

在这种情况下如何使用存储过程?可以使用游标循环吗?

请引导我...........
在此先感谢,

Hi all....

i have two table in a process which belongs primary and secondary instances,
i''v to do the process simultanously for both secondary and primary
secondary contents are from table2 and primary contents are in table1,

i''v to select value which relates to the instances of two tables............

how can i use stored procedure for this situation can i use loops are cursor,

pls guide me...........
thanks in advance,

推荐答案



您可以为此使用sql server游标.检查这些链接-

http://msdn.microsoft.com/en-us/library/ms180169.aspx [ ^ ]

http://www.mssqltips.com/sqlservertip/1599/sql-server-cursor-examples / [ ^ ]
Hi,

You can use sql server cursor for this. Check these links-

http://msdn.microsoft.com/en-us/library/ms180169.aspx[^]

http://www.mssqltips.com/sqlservertip/1599/sql-server-cursor-examples/[^]


您可以用 CTE替换很多光标s [ ^ ]如果您使用的是 SQL 2005 或更高版本
You can replace a lot of cursors with CTE''s[^] if you are using SQL 2005 or above


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

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