当前位置:网站首页>SQL Server 游标循环表数据
SQL Server 游标循环表数据
2022-04-23 10:24:00 【---清心寡欲---】
实现功能,利用游标循环表数据,并打印出来
表数据内容

实现的思路

实现代码:
declare @id nvarchar(200)
declare @name nvarchar(150)
declare @parentid nvarchar(200)
declare data cursor for
select id,name,parentid from sys_org
open data
fetch next from data into @id, @name, @parentid
while (@@fetch_status = 0)
begin
-- 需要执行的语句
print 'id:'+@id
+' name:'+@name
+' parentid:'+ @parentid
fetch next from data into @id, @name, @parentid
end
close data
deallocate data
执行效果

版权声明
本文为[---清心寡欲---]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ying456baby/article/details/121632686
边栏推荐
- 202、快乐数
- 任意文件读取漏洞 利用指南
- Juc并发编程07——公平锁真的公平吗(源码剖析)
- Realizing data value through streaming data integration (5) - flow analysis
- ARM调试(1):两种在keil中实现printf重定向到串口的方法
- MapReduce compression
- Examination questions and answers of the third batch (main person in charge) of Guangdong safety officer a certificate in 2022
- C语言——自定义类型
- Chapter 2 Oracle database in memory architecture (I) (im-2.1)
- Sim Api User Guide(6)
猜你喜欢

101. Symmetric Tree

Net start MySQL MySQL service is starting MySQL service failed to start. The service did not report any errors.

Reading integrity monitoring techniques for vision navigation systems - 3 background

/etc/shadow可以破解吗?
![[untitled]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[untitled]

mysql同一个表中相同数据怎么合并

Zhengda international explains what the Dow Jones industrial index is?

Question bank and answers of Shanghai safety officer C certificate examination in 2022

Read LSTM (long short term memory)

Shell script interaction free
随机推荐
Art template template engine
Question bank and answers of Shanghai safety officer C certificate examination in 2022
域名和IP地址的联系
Juc并发编程06——深入剖析队列同步器AQS源码
Sim Api User Guide(5)
1. Sum of two numbers (hash table)
[untitled]
shell脚本免交互
Exercise questions and simulation test of refrigeration and air conditioning equipment operation test in 2022
通过流式数据集成实现数据价值(1)
209、长度最小的子数组(数组)
Realize data value through streaming data integration (1)
206、反转链表(链表)
基于PyQt5实现弹出任务进度条功能示例
SSH利用私钥无密钥连接服务器踩坑实录
Jerry's factors that usually affect CPU performance test results are: [article]
art-template 模板引擎
2022 mobile crane driver test question bank simulation test platform operation
101. Symmetric Tree
Windows installs redis and sets the redis service to start automatically