sql 遍历结果集
2015-11-04 10:51
176 查看
declare @temp table ( [id] int IDENTITY(1,1), [Name] varchar(10) ) --select * from @temp declare @tempId int,@tempName varchar(10) insert into @temp values('a') insert into @temp values('b') insert into @temp values('c') insert into @temp values('d') insert into @temp values('e') --select * from @temp WHILE EXISTS(select [id] from @temp) begin SET ROWCOUNT 1 select @tempId = [id],@tempName=[Name] from @temp SET ROWCOUNT 0 delete from @temp where [id] = @tempId print 'Name:----'+@tempName end
相关文章推荐
- SQLserver和oracle中对应的数据类型
- redis 多数据库
- SQLServer基本操作
- excel文件生成本地数据库
- Oracle CHAR,VARCHAR,VARCHAR2,nvarchar类型的区别与使用(转载)
- ORACLE数据库:日期时间函数大全
- 修改mysql的默认存储引擎
- MySQL之explain 的type列 & Extra列
- .NET连接SQL Server的问题处理
- Memcached的管理与监控工具--MemAdmin
- Redis服务器
- MySQL索引原理及慢查询优化
- VS2015下编译 MONGODB 驱动
- 对memcached使用的总结和使用场景
- 数据库 三范式最简单最易记的解释
- 一文了解甲骨文云计算全景,看“狂人”拉里如何重新洗牌云产业
- centos7安装配置memcached
- 转:ibatis动态sql
- 转:ibatis动态sql
- ORACLE EXPDP命令使用详细