{"id":650,"date":"2018-06-24T22:16:26","date_gmt":"2018-06-24T14:16:26","guid":{"rendered":"https:\/\/blog.freesilo.com\/?p=650"},"modified":"2018-06-24T22:16:26","modified_gmt":"2018-06-24T14:16:26","slug":"%e5%88%a9%e7%94%a8sql%e8%af%ad%e5%8f%a5%e6%9f%a5%e6%89%be%e6%9f%90%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e6%89%80%e6%9c%89%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%8c%85%e5%90%ab%e7%9a%84%e5%86%85","status":"publish","type":"post","link":"https:\/\/freesilo.com\/?p=650","title":{"rendered":"\u5229\u7528SQL\u8bed\u53e5\u67e5\u627e\u67d0\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5b58\u50a8\u8fc7\u7a0b\u5305\u542b\u7684\u5185\u5bb9"},"content":{"rendered":"<p>Use \u6570\u636e\u5e93<br \/>\nDECLARE @ProcName varchar(50)<br \/>\nCreate Table #tmpName(Content varchar(2000))<br \/>\nCreate Table #tmp(ProcName varchar(2000),Content1 varchar(8000))<br \/>\n&#8211;\u5b9a\u4e49\u4e00\u4e2a\u6e38\u6807<br \/>\nDECLARE SearchProc CURSOR FOR<br \/>\n&#8211;\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u79f0\uff0c\u5c3d\u91cf\u53bb\u9664\u7cfb\u7edfPROC\uff0c\u53ef\u4ee5\u6839\u636ecrdate\u65f6\u95f4\u5b57\u6bb5\u6765\u5bfb\u627e\u975e\u7cfb\u7edfPROC<br \/>\nselect name from sysobjects where type=&#8217;P&#8217; and name not like &#8216;dt_%&#8217;<br \/>\nOPEN SearchProc<br \/>\nFETCH NEXT FROM SearchProc<br \/>\nINTO @ProcName<\/p>\n<p>WHILE @@FETCH_STATUS &gt;=0<br \/>\nBEGIN<br \/>\nPrint @ProcName<br \/>\nInsert Into #tmpName(Content) Exec sp_helptext @ProcName<br \/>\nInsert Into #tmp(ProcName,Content1) select @ProcName,#tmpName.Content from #tmpName<br \/>\n&#8211;\u586b\u5145\u5b8c\u5c31\u6e05\u7a7a\u4e00\u4e0b\u4e34\u65f6\u8868<br \/>\nTruncate table #tmpName<br \/>\nFETCH NEXT FROM SearchProc<br \/>\nINTO @ProcName<br \/>\nEND<br \/>\nCLOSE SearchProc<br \/>\nDEALLOCATE SearchProc<br \/>\nGO<\/p>\n<p>select ProcName from #tmp where Content1 like &#8216;%\u67e5\u627e\u5185\u5bb9%&#8217; group by ProcName<\/p>\n<p>select ProcName,Content1 from #tmp where Content1 like &#8216;%\u67e5\u627e\u5185\u5bb9%&#8217;<\/p>\n<p>select ProcName,Content1 from #tmp where procname=&#8217;\u5b58\u50a8\u8fc7\u7a0b\u540d\u79f0&#8217;<br \/>\n&#8211;\u5220\u9664\u4e34\u65f6\u8868<br \/>\nDrop Table #tmpName<br \/>\nDrop Table #tmp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use \u6570\u636e\u5e93 DECLARE @ProcName varchar(50) Cr&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/freesilo.com\/?p=650\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-650","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/650","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=650"}],"version-history":[{"count":2,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/650\/revisions"}],"predecessor-version":[{"id":889,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/650\/revisions\/889"}],"wp:attachment":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}