-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_dml_procs.sql
More file actions
25 lines (23 loc) · 919 Bytes
/
Copy pathfind_dml_procs.sql
File metadata and controls
25 lines (23 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use adventureworks
select db_name() as 'db name', a.name, b.text
from sys.objects a
right outer join sys.syscomments b
on a.object_id = b.id
where a.type = 'P'
and (
b.text like '%insert%'
or b.text like '%update%'
or b.text like '%delete%'
)
and DB_NAME() not in ( 'master', 'model', 'msdb', 'tempdb', 'distribution' )
and ( left( a.name, 5 ) != 'maint' or LEFT( a.name, 3 ) != 'dt_' )
order by a.name
exec master.sys.sp_MSforeachdb
'use [?]; select db_name() as ''db name'', a.name as ''proc name'',
b.text from sys.objects a
right outer join sys.syscomments b
on a.object_id = b.id where a.type = ''P'' and (
b.text like ''%insert%'' or b.text like ''%update%'' or b.text like ''%delete%'' )
and db_name() not in ( ''master'', ''msdb'', ''model'', ''tempdb'', ''distribution'' )
and ( left( a.name, 5 ) != ''maint'' or LEFT( a.name, 3 ) != ''dt_'' )
order by a.name'