SQL Server queries a table for dependent views, stored procedures, functions

Source: Internet
Author: User
Sp_depends ' table name ' But this is a good way to save all the SQL statements from being exported and looking for. However, as a reminder, if you use this table in dynamic SQL in a stored procedure, you are not expected to find it. SELECT name, definition
From Sys.all_objects o
Inner join sys.sql_modules m on m.object_id = o.object_id
WHERE (o.[type]= ' P ' or o.[type]= ' X ' or o.[type]= ' PC ')
and o.[is_ms_shipped]=0
and definition like '%t_forminstance_global% '
Order BY name
This method can be used to find the table dependencies in dynamic SQL, where "T_forminstance_global" is the table name.
But the type of sys.all_objects needs to be given to the specific reference: http://technet.microsoft.com/zh-cn/LIBRARY/ms178618

SQL Server queries a table for dependent views, stored procedures, functions

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.