푸른청년 푸르게 살고있나?  
home | 살아가기 | news | 세상보기 | tip&tech | 방명록 |  
   전체
   asp
   php
   jsp
   mssql
   mysql
   informix
   linux
   unix
   win2000
   javascript
   html
   oracle
   java
   etc
    
:: Tip&Tech > mssql
특정테이블의 row수, 사이즈등을 알고 싶을때 쓰는 프로시져
- 특정 테이블만 알고 싶을때
EXEC sp_spaceused '테이블명';

- 특정디비의 모든 테이블에 대해서 알고 싶을때
use mousebbs
go
exec sp_MSforeachtable "exec sp_spaceused '?'"

- 조건에 따른
use mouseBBS
go
declare @tblName varchar(30)
declare curGetTableName INSENSITIVE CURSOR

for
select tableName from tableinfo where groupcode=2
for read only

open curGetTableName

fetch from curGetTableName into @tblname

while @@FETCH_STATUS = 0
begin
exec sp_spaceused @tblName
FETCH FROM curGetTableName INTO @tblName
end

close curGetTableName
deallocate curGetTableName
go

날짜: 2005-10-11 11:58:27, 조회수: 2881

다음글 실행 중인 SQL Server 2000의 버전을 확인하는 방법
이전글 mssql 7.0에서의 replication 즉 복제..

꼬리말
글쓴이 비밀번호 #스팸글방지(주인장 닉네임을 쓰시오)

  
since by 2003.03.23 / 3th 2005.07.26 / 4th 2009.04.22 made by bluesoul