当前位置:网站首页>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
边栏推荐
- 206、反转链表(链表)
- Leetcode22:括号生成
- 1. Sum of two numbers (hash table)
- 24. Exchange the nodes in the linked list (linked list)
- Construction and traversal of binary tree
- 第二章 Oracle Database In-Memory 体系结构(上) (IM-2.1)
- Turn: Maugham: reading is a portable refuge
- 通过流式数据集成实现数据价值(1)
- JVM——》常用参数
- 中职网络安全2022国赛之CVE-2019-0708漏洞利用
猜你喜欢
【无标题】
Configuration of LNMP
Initial exploration of NVIDIA's latest 3D reconstruction technology instant NGP
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
Sim Api User Guide(6)
MapReduce core and foundation demo
解决方案架构师的小锦囊 - 架构图的 5 种类型
Sim Api User Guide(6)
Arm debugging (1): two methods to redirect printf to serial port in keil
Juc并发编程07——公平锁真的公平吗(源码剖析)
随机推荐
JUC concurrent programming 09 -- source code analysis of condition implementation
Windows installs redis and sets the redis service to start automatically
MapReduce core and foundation demo
JUC concurrent programming 07 -- is fair lock really fair (source code analysis)
24、两两交换链表中的节点(链表)
Realizing data value through streaming data integration (4) - streaming data pipeline
C语言——自定义类型
101. Symmetric Tree
SQL调优系列文章之—SQL性能方法论
Chapter 1 Oracle database in memory related concepts (im-1.1)
通过流式数据集成实现数据价值(4)-流数据管道
Define linked list (linked list)
2022年制冷与空调设备运行操作考试练习题及模拟考试
349、两个数组的交集
景联文科技—专业数据标注公司和智能数据标注平台
Zhengda international explains what the Dow Jones industrial index is?
Chapter II in memory architecture (im-2.2)
Net start MySQL MySQL service is starting MySQL service failed to start. The service did not report any errors.
第二章 In-Memory 体系结构 (IM-2.2)
通过流式数据集成实现数据价值(5)- 流处理