2009.05.14 18:55
보통 적으로 많이 사용하는 쿼리들 입니다.
--System table Query
select * from sysobjects where xtype='u'
--Table size
select table_name = convert(varchar(30), min(o.name)), table_size = ltrim(str(sum(reserved) *8192/1024,15,0) + 'kb'),crdate,refdate
from sysindexes i inner join sysobjects o on (o.id = i.id)
where i.indid in (0,1,255) and o.xtype = 'U'
group by i.id,crdate, refdate
order by refdate desc
--Table PK 기본키
select name from sysobjects where xtype ='pk'
--Table name
select x.id, substring(y.name,1,30) as [table], substring(x.name,1,30)
as field_name, substring(type_name(x.xusertype),1,20) as type,
convert(int,x.length) as length
from syscolumns x inner join
sysobjects y on x.id = y.id
where (y.type='U')
order by x.id, y.name, x.colid
-- Columns
select * from syscolumns
--Table Field
sp_helpindex s_member_tbl
--# 참고 Sysobjects
select * from sysobjects
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
10 | [MSSQL] 다른 테이블로 데이터 INSERT | 호스트웨이 | 2015.09.16 | 8978 |
9 | MSSQL Express Backup 자동화 | 호스트웨이 | 2015.05.06 | 8868 |
8 | DB 소유권 이전 | 호스트웨이 | 2012.06.01 | 8859 |
7 | [MSSQL]인덱스 (INDEX) 사용하기 | 호스트웨이 | 2015.09.16 | 8744 |
6 | mssql-table backup(테이블 백업/복원) | 호스트웨이 | 2015.09.09 | 8716 |
5 | DB 마이그레이션 방법 | 호스트웨이 | 2012.04.27 | 7421 |
4 | [MS SQL]트랜잭션 사용 | 호스트웨이 | 2015.09.15 | 7411 |
3 | MS-SQL 서버 메모리 사용량 제한 | 호스트웨이 | 2012.12.14 | 7286 |
2 | Windows Server2008 에서 MSSQL2005 Reporting Service 설치하기 | 호스트웨이 | 2012.03.09 | 6531 |
1 | DBConnectionOpen오류 | 호스트웨이 | 2012.07.14 | 6367 |