Step1 . Replace your object name in the place of TABLENAME
Step2 .
Run this
exec sp_MSforeachdb
';with cte as (
select db_id() as dbid,db_name() as dbname,
so.name,
sc.text
from
sysobjects so inner join syscomments sc on
so.id = sc.id
where
sc.text like ''%INSERT%INTO%TABLENAME%''
or sc.text like ''%UPDATE%TABLENAME%''
and so.xtype = ''P''
union all
select db_id() as dbid,db_name() as
dbname,
so.name,
sc.text
from
sysobjects so inner join syscomments sc on
so.id = sc.id
where
sc.text like
''%insert%into%TABLENAME%''
or sc.text like ''%UPDATE%TABLENAME%''
and so.xtype = ''P''
)
select * from cte where dbid not in
(''1'',''2'',''3'',''4'',''5'',''6'')
No comments:
Post a Comment