Saya akan menggunakan object_definition
fungsi
dan sys.procedures
lihat
begini:
declare @word varchar(128)
set @word = 'place'
select name, (len(object_definition(object_id)) - len(replace(object_definition(object_id), @word, ''))) / len (@word) as qty
from sys.procedures
where object_definition(object_id) like '%'[email protected]+'%' and type = 'P'
order by name
Ditambahkan setelah komentar, semua kemunculan kata tertentu di semua prosedur tersimpan:
declare @word varchar(128)
set @word = 'place'
select sum((len(object_definition(object_id)) - len(replace(object_definition(object_id), @word, ''))) / len (@word)) as qty
from sys.procedures
where object_definition(object_id) like '%'[email protected]+'%'
Berikut ini berfungsi (dan diperbarui setelah komentar) contoh:http://sqlfiddle.com/#! 3/a759c/7