sqlserver 游标的简单示例

时间:2024-01-12 13:29:01 

Declare @Id varchar(20)
Declare @Name varchar(20)
Declare Cur Cursor For
select substring(id,0,7) as id,name from temp1
Open Cur
Fetch next From Cur Into @Id,@Name
While @@fetch_status=0
Begin
Update temp Set [c3]=@Name where [id] like @Id+'%'
Fetch Next From Cur Into @Id,@Name
End
Close Cur
Deallocate Cur

标签:sqlserver,游标
0
投稿

猜你喜欢

  • Python开发常用五种循环方式的场景性能比较

    2021-11-19 13:24:00
  • 解读python中的类型提示(type hint)

    2023-07-15 20:16:27
  • 通过Python实现电脑定时关机的两种方法

    2023-05-09 03:23:50
  • Bootstrap图片轮播效果详解

    2023-08-24 20:31:55
  • JavaScript实现x秒后自动跳转到一个页面

    2024-04-18 10:00:55
  • php封装的单文件(图片)上传类完整实例

    2024-05-03 15:50:18
  • Python连接MySQL并使用fetchall()方法过滤特殊字符

    2024-01-23 07:35:36
  • Mysql错误1366 - Incorrect integer value解决方法

    2024-01-13 03:21:35
  • Centos 6.4源码安装mysql-5.6.28.tar.gz教程

    2024-01-25 09:39:58
  • Django Admin中增加导出CSV功能过程解析

    2021-04-17 06:22:47
  • Windows下mysql5.7.10安装配置方法图文教程

    2024-01-19 16:19:43
  • CSS雪碧:要还是不要?

    2009-11-16 13:01:00
  • 人工智能自动sql优化工具--SQLTuning for SQL Server

    2024-01-25 00:54:15
  • Vue中子组件调用父组件的3种方法实例

    2024-05-13 09:08:18
  • AJAX初体验之上手篇

    2007-08-23 08:50:00
  • cv2.imread 和 cv2.imdecode 用法及区别

    2023-12-03 06:15:49
  • Python3操作YAML文件格式方法解析

    2021-05-22 03:57:10
  • Typora 0.11.18免费版本安装使用教程(亲测可用)

    2023-10-29 16:56:58
  • python fabric实现远程操作和部署示例

    2021-07-18 14:22:14
  • 推荐系统MostPopular算法的Python实现方式

    2022-04-21 14:44:24
  • asp之家 网络编程 m.aspxhome.com