Development/MsSql

MS SQL Text 검색

@위너스 2008. 10. 30. 20:53
users란 text를 가진 프로지저 또는 테이블을 검색
select object_name(id) from syscomments
where [text] like '%users%'

xtype : 프로시저냐? 테이블이냐?, status : 유형이 사용자면 0이상 시스템이면 0 보다 작다
select * from sysobjects
where xtype = 'P' and status >= 0  
 

 해당 테이블명을 사용한 SP목록 조회

sp_depends [테이블명] 

 

SP 내용 조회

select s.name, o.name
 from sys.objects o
  join sys.schemas s on o.schema_id = s.schema_id
  join syscomments t on t.id = o.object_id
 where t.text like ''%내용%''
 group by s.name, o.name
 order by s.name, o.name