SQL Server finds all stored procedures that use a field

Source: Internet
Author: User

When a system uses a lot of tables, and there are a lot of stored procedures, when a table in the database deleted a field, then the corresponding stored procedures need to be changed, but we do not know which stored procedures used the field, then what should we do? We can find stored procedures that use the field from one previous document, but this is much more efficient and error-prone, and we can use the following method to find all stored procedures that use a field.

The first method:

Selectobject_name (ID), * fromsyscomments wheretext like '% of the content you want to check

The second method:

The following functions:

[SQL]

SELECT obj. Name stored procedure name, SC. Text Stored procedure content

From syscomments SC

INNER JOIN sysobjects obj on SC. Id = obj.id

WHERE SC. Text like '% of what you want to look for% '

SQL Server finds all stored procedures that use a field

Related Article

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.