object_definition を使用します 関数
および sys.procedures ビュー
このように:
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 '%'example@sqldat.com+'%' and type = 'P' order by nameプレ>追加 コメントの後、すべてのストアド プロシージャ内の特定の単語のすべての出現:
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 '%'example@sqldat.com+'%'プレ>これが機能している(そしてコメント後に更新された)例です: https://sqlfiddle.com/#! 3/a759c/7