SQL SERVER 建临时表、循环插入数据、游标遍历数据库
2015-09-18 18:28
701 查看
create table #tmp (id int) --建立临时数据表 declare @x int --循环插入数据 set @x=1 while @x<=10 begin insert into #tmp values(@x) set @x=@x+1 end --建立游标 遍历数据库 declare tmpCursor CURSOR for select * from #tmp open tmpCursor declare @id int fetch next from tmpCursor into @id while @@FETCH_STATUS =0 begin print @id fetch next from tmpCursor into @id end
相关文章推荐
- MySQL中将.frm,.myd,.myi文件导入数据库
- MySQL:远程访问权限,is not allowed to connect to this MySQL server
- 5 个免费的受欢迎的 SQLite 管理工具
- MYSQL函数group_concat的使用
- MYSQL查询优化:管理员的优化措施
- MYSQL查询优化:调度和锁定
- db2look导出数据库结构
- MYSQL查询优化:数据类型与效率
- MYSQL查询优化:使用索引
- Oracle Linux 6 下 Oracle RDBMS Server 11gR2 Preinstall RPM 包说明
- MYSQL查询优化:Limit
- MYSQL查询优化(二)
- sql case 用法总结
- MYSQL查询优化(一)
- SQLLITE3
- 数据库的优化
- 数据库的优化
- 数据库的优化
- 数据库的优化
- [mongodb] mongoose增删改查