日期:2014-05-18  浏览次数:20402 次

!!!游标的奇怪问题!!!
——如下格式的使用,在查询结果集中只有8条数据,可是该游标却循环了9次(其中,有条数据重复处理了1次!奇怪!!???)
declare   deal_cur   cursor   for
      select   ……  
open   deal_cur
fetch   deal_cur   into   ……
while   @@fetch_status   =   0
begin      
fetch   deal_cur   into   ……
end
close   deal_cur
deallocate   deal_cur
——大家曾否遇到过???

------解决方案--------------------
结果--
1
2
3
4
5
6
7
8
------解决方案--------------------
clustered index 族集索引,其值没有规则限制,非NULL
unique clustered index 唯一族集索引,其值在该列必须唯一,非NULL