如何在sql DB中的storeproc中使用所有临时表名称 [英] How to get all temp tables names using in storeproc in sql DB
本文介绍了如何在sql DB中的storeproc中使用所有临时表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取所有临时表名称的列表并在sql DB中的storeproc中使用
How to get list of all temp tables names and using in storeproc in sql DB
推荐答案
FYI tempdb中保存的所有临时表。
您可以尝试此查询列出在存储过程中使用的所有临时表。
FYI All the temp tables saved in tempdb.
you can try this query to list all the temp table which are using in stored procedures.
select name from tempdb.sys.tables A WHERE EXISTS (
SELECT o.name
FROM sys.sql_modules m
INNER JOIN
sys.objects o
ON m.object_id = o.object_id
WHERE m.definition LIKE '%' + A.name + '%'
)
这篇关于如何在sql DB中的storeproc中使用所有临时表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文