有没有办法获取 SQL Server 中所有当前临时表的列表? [英] Is there a way to get a list of all current temporary tables in SQL Server?

查看:30
本文介绍了有没有办法获取 SQL Server 中所有当前临时表的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到临时表是会话/连接绑定的,并且在会话/连接之外不可见或不可访问.

I realize that temporary tables are session/connection bound and not visible or accessible out of the session/connection.

我有一个长时间运行的存储过程,它在各个阶段创建临时表.

I have a long running stored procedure that creates temporary tables at various stages.

有没有办法查看当前临时表的列表?我需要什么权限才能这样做?

Is there a way I can see the list of current temporary tables? What privileges do I need to be able to do so?

或者,

有没有办法可以看到正在运行的存储过程中正在执行的特定 SQL 语句?该过程作为 SQL Server 中的计划作业运行.

Is there a way I can see the particular SQL statement being executed inside a running stored procedure? The procedure is running as a scheduled job in SQL Server.

我使用的是 SQL Server 2000.

I am using SQL Server 2000.

感谢您的指导.

推荐答案

这就是你想要的吗?

select * from tempdb..sysobjects
--for sql-server 2000 and later versions

select * from tempdb.sys.objects
--for sql-server 2005 and later versions

这篇关于有没有办法获取 SQL Server 中所有当前临时表的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆