Thursday, December 30, 2010

Foreach printre baze de date

create table #tmpUse (
ProcName varchar(128),
DBName varchar(128)
)

EXEC master.sys.sp_MSforeachdb "USE [?];insert #tmpUse select object_name(id),db_name() from syscomments where lower(text) like '%opendatasource%'"

select object_name(id), * from syscomments where lower(text) like '%opendatasource%'
select object_name(id), * from syscomments where lower(text) like '%openrowset%'
select object_name(id), * from syscomments where lower(text) like '%openquery%'

No comments:

Post a Comment