DB 에 있는 모든 테이블의 크기를 구하기
페이지 정보
작성자 서방님 댓글 0건 조회 127회 작성일 06-11-02 15:02본문
sp_spaceused를 아셨다면 거의 답에 접근한 형태입니다.
그걸 userTable만 순환시켜주면 가능한 형태입니다.
create proc sp_tableinfo
as
set nocount on
declare tab_cur cursor for
select name from sysobjects where type='u'
open tab_cur
declare @tabname varchar(50)
fetch from tab_cur into @tabname
while (@@fetch_status=0)
begin
fetch next from tab_cur into @tabname
exec ('sp_spaceused ' + @tabname)
end
set nocount off
close tab_cur
deallocate tab_cur
위의 과정은 그 것을 하는 것으로 sp_tableinfo가 만들어지게 됩니다.
그럼 실행을 해보세요.
보기 좋게 하려면 ctrl + T (텍스트로 결과보기)를 눌러 실행하시면 됩니다.
댓글목록
등록된 댓글이 없습니다.