sqlserver 游标的简单示例

前端之家收集整理的这篇文章主要介绍了sqlserver 游标的简单示例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

猜你在找的MsSQL相关文章