*/ ifobject_id('tb') isnotnulldroptable tb go createtable tb (id int) go insert tb select2 unionallselect1 unionallselect3 go createindex idx1 on tb(id) go setrowcount2 delete a from tb a with(index= idx1) setrowcount0 go select*from tb go
/*SQL2000快速批量删除前N条数据--前提:只能根据拥有聚集索引的id才能达到准确无误的删除操作--下面是一个简单的例子--废话不多说,看代码*/if object_id(tb) is not null drop table tbgocreate table tb (id int)goinsert tb select 2union all sele