Chinaunix首页 | 论坛 | 博客
  • 博客访问: 576123
  • 博文数量: 855
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5005
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-16 19:08
文章分类

全部博文(855)

文章存档

2011年(1)

2008年(854)

我的朋友

分类:

2008-10-16 19:10:16

方法一:

delete from tb_channel a where a.rowid in

(select max(b.rowid) from tb_channle b

where a.policyno=b.policyno and a.classcode=b.classcode);

——这一办法在数据记录超过10万时一般都会变得很慢。

方法二:

--建立临时表,--清空原表,--插回原表,如下例:

create table temp_emp as (select distinct * from employee) ;

truncate table employee;

insert into employee select * from temp_emp;

——这一办法适用于较大的表的情况。因为是块操作,对应于大表效率会好很多

方法三:

--建立新表,--去重复放入,--删除原表,如下例:

select distinct * into new_table from old_table

order by 主 键

drop table old_table

exec sp_rename new_table,old_table;

——这一办法适用于较大的表的情况。因为是块操作,对应于大表效率会好很多

【责编:Chuan】

--------------------next---------------------

阅读(227) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~