fly'sBlog

导航

SqlServer 查看数据库中存储过程用到的sql或表

select * from syscomments where text like '%  %'

SELECT
Name,--存储过程名字
Definition --存储过程内容
FROM sys.sql_modules AS m
INNER JOIN sys.all_objects AS o ON m.object_id = o.object_id
WHERE m.definition like '%SELECT * INTO %'--存储过程内容

SELECT
Name,--存储过程名字
Definition --存储过程内容
FROM sys.sql_modules AS m
INNER JOIN sys.all_objects AS o ON m.object_id = o.object_id
WHERE o.[type] = 'P'--表名

posted on 2023-03-30 11:03  fly'sBlog  阅读(179)  评论(0编辑  收藏  举报