久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

SQL- 計算所有存儲過程中特定單詞的出現次數

SQL- Count occurrences of a specific word within all stored procedures(SQL- 計算所有存儲過程中特定單詞的出現次數)
本文介紹了SQL- 計算所有存儲過程中特定單詞的出現次數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我需要計算所有存儲過程中特定單詞的出現次數.

I need to count the occurrences of a particular word in all of my stored procedures.

即位置"一詞在特定數據庫中的所有存儲過程中出現多少次?

i.e. How many times does the word 'place' occur in all of the stored procedures within a specific database?

我試圖使用游標來做到這一點,但我無處可去!

I was trying to do this using cursors, but I am not getting anywhere!

推薦答案

我會使用 object_definition 函數 和 sys.procedures 以這種方式查看:

I would use object_definition function and sys.procedures view this way:

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 '%'+@word+'%' and type = 'P'
order by name

在注釋后添加,所有存儲過程中出現的所有特定單詞:

Added after comment, all occurrences of specific word in all stored procedures:

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 '%'+@word+'%'

這是工作(并在評論后更新)示例:http://sqlfiddle.com/#!3/a759c/7

Here is working (and updated after comment) example: http://sqlfiddle.com/#!3/a759c/7

這篇關于SQL- 計算所有存儲過程中特定單詞的出現次數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 最新国产精品精品视频 | 亚洲国产网址 | 日韩成人精品在线观看 | 国产日韩一区二区 | 亚洲福利视频一区二区 | 国产剧情久久 | 国产最新精品视频 | 久久综合狠狠综合久久综合88 | 午夜亚洲 | 亚洲国产精品久久久久 | 亚洲国产成人在线视频 | 精品久久久久久亚洲国产800 | 毛片视频网站 | 干干干操操操 | 久久777| 美女二区 | 国产成人精品一区二区三区四区 | www.亚洲精品| 亚洲午夜久久久 | 婷婷毛片 | av一级久久 | 夜夜爽99久久国产综合精品女不卡 | 一级片在线免费看 | 超碰日韩 | 国产成人综合久久 | 国精产品一区一区三区免费完 | 亚洲精品久久久久久一区二区 | 国产电影一区二区 | 成人精品一区二区 | 激情国产视频 | 久久久国产一区二区三区 | 久草成人网 | 亚洲一本| 一级做a| 日韩小视频在线 | 99re在线免费视频 | 国产精品久久久久久吹潮 | 亚洲视频一区在线观看 | 91精品一区二区 | 欧美日韩国产精品一区 | 欧美日韩亚|