惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
M
MIT News - Artificial intelligence
D
Docker
S
SegmentFault 最新的问题
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
Check Point Blog
GbyAI
GbyAI
美团技术团队
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog

博客园 - FilyCks

SQL动态条件查询例子 日期格式化函数 解决日志文件满造成的无法写入问题 数据库的日志文件 Delphi制作DLL SQLSERVER 日期函数及取当天数据 SQL语句导入导出大全 日期数据处理 按时间段统计数据(1) FastReport(5) FastReport(4) FastReport(3) FastReport(2) FastReport(1) 游标嵌套(个人笔记) FastReport 的初学感悟 查询表(个人笔记) 图片转换和读取(个人笔记) 游标的一些例子
自己研究出来的第一个游标
FilyCks · 2008-03-10 · via 博客园 - FilyCks

create table #temp(ttype varchar(50),tno int)
declare @temp_type1 varchar(50) 
declare @temp_type2 varchar(50)
declare @temp_no int                 
declare mycursor cursor for select imagetype,imageno from imageproperty_t where
archno='141227'order by imageno 

open mycursor                  

fetch next from mycursor  into @temp_type1,@temp_no  
set @temp_type2=@temp_type1
insert into #temp values(@temp_type1,@temp_no)

while(@@fetch_status=0)   
begin
   if @temp_type1<>@temp_type2
      insert into #temp values(@temp_type1,@temp_no)
   set @temp_type2=@temp_type1
     
    fetch next from mycursor into @temp_type1,@temp_no   
end

close mycursor

select * from #temp order by tno