관리 메뉴

Data Modeling Evangelist Kaien Kim's Blog

카탈로그내에서 특정 컬럼을 참조하는 SP조회 본문

DATA/SQLServer

카탈로그내에서 특정 컬럼을 참조하는 SP조회

2008. 11. 13. 18:37

select

col.table_catalog,

col.table_name,

col.column_name,

obj2.name as SP_Name,

obj2.id as SP_ID

from sysdepends dep, sysobjects obj, sysobjects obj2, information_schema.columns col

where dep.depid = obj.id

  and dep.id    = obj2.id

  and obj.name  = col.table_name

  and col.column_name = 'ssn'

  and obj2.xtype='P'

group by col.table_catalog, col.table_name, col.column_name, obj2.name, obj2.id

etc...
sp_tables
-- 테이블 리스트
select * from information_schema.tables
-- 컬럼 상세 정보
select * from information_schema.columns
where table_name = '테이블명'
order by 5

'DATA > SQLServer' 카테고리의 다른 글

[SQLServer]특정테이블의 컬럼정보 가져오기  (0) 2009.01.16
[MSSQL]남은 디스크공간 알아내는 방법  (0) 2008.11.21
[MSSQL]테이블 소유자 변경하기  (0) 2008.08.20
MSSQL 괜찮은 명령어들  (0) 2008.07.30
Trigger  (0) 2008.07.30