SQL Server to find all stored procedures that contain a text

Source: Internet
Author: User
Tags copy sql
Let me show you the picture.

The above figure stored procedure called Mup_geta (I wiped out the name associated with the project)

The above illustration uses the SQL Server Graphics manager's own features to view objects that depend on Mup_geta.

The result was a bit shocking and it didn't list MUP_GETB (I'm using SQL Server 2005)


Here's how to fix it
Method 1:
Open the database management interface-> Right click on the database->tasks->generate scripts-> ...
Export all stored procedures to a file, and then ctrl+f find
Method 2:
Copy Code code as follows:
SELECT Routine_name, Routine_definition
From INFORMATION_SCHEMA. Routines
WHERE routine_definition like "%text%"
and routine_type= "PROCEDURE"

Replace text with what you're looking for

Method 3:
Copy Code code as follows:
Select Name
From sysobjects O, syscomments s
where o.id = S.id
and text like "%text%"
and O.xtype = "P"

Replace text with what you're looking for

Complete

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.