블로그 이미지
010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (500)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글


if object_id('tblx') is not null
drop table tblx
go

create table tblx
(
c1 int identity(1,1)
,c2 int
)
go

insert tblx values (1)
go 30

create clustered index cl_tblx_desc on tblx (c1 desc )
go

create nonclustered index nc_tblx_asc on tblx (c1 asc )
go

delete top (10) t from tblx t with (index(cl_tblx_desc));
go

select top 20 * from tblx order by c1 desc
go

delete top (10) t from tblx t with (index(nc_tblx_asc));
go

select top 20 * from tblx order by c1 asc
go

 

 

 

 

잘라서 지우기

drop table tblx
go

select top 100 a.* into tblx
from sys.sysobjects a
, sys.sysobjects b
, sys.sysobjects c
, sys.sysobjects d
go


while (1=1) begin
 delete a
   from (select top 1000 *
     from tblx 
    where xtype = 's') a
 if @@rowcount = 0 break
 waitfor delay '00:00:00.100'
end
go

select count(*) from tblx
go

 

아래와 같이도 된다.

delete top (1000)
from tblx
where xtype = 's'

Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함