全局临时表相对于 ADO.NET 数据库连接的范围?

发布于 2024-08-22 02:57:25 字数 517 浏览 4 评论 0原文

SQL Server 在线书籍规定以下有关可见性的内容临时表的(范围?):

临时表
您可以创建本地和全局临时表。 本地临时表可见 仅在当前会话中; 全球 临时表对所有人可见 会话

我想了解全局临时表的范围如何与 ADO.NET 数据库连接相关。在 ADO.NET 连接期间创建的全局临时表是否会在该连接之外持续存在以供将来的连接使用?一起启动和停止的并行 ADO.NET 连接怎么样?

我没有看到 Microsoft 在 SQL 上下文中使用“会话”一词与在 ADO.NET 上下文中使用“连接”一词之间的关联(如果它们属于同一或不同的语言)不是。

SQL Server books online states the following about visibility (scope?) of temporary tables:

Temporary Tables
You can create local and global temporary tables.
Local temporary tables are visible
only in the current session; global
temporary tables are visible to all
sessions
.

I want to understand how the scope of the global temporary table relates to an ADO.NET database connection. Will a global temp table created during an ADO.NET connection persist beyond that connection for future connections to use? What about parallel ADO.NET connections that start and stop together?

I'm not seeing the association between Microsoft's use of the word session in SQL context and the word connection in ADO.NET context, if they're one in the same or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰葑 2024-08-29 02:57:25

它们是相同的,一个连接获取一个会话 SPID,该表应该一直存在,直到它被删除或者您

在一个窗口中

create table ##temp ( ID int)
insert ##temp values (1)

重新启动 sql server 实例,现在从另一个连接执行此操作,执行此操作

select * from ##temp

they are the same, a connection gets a session SPID, the table should be there until it is dropped or you restart the sql server instance

in one window do this

create table ##temp ( ID int)
insert ##temp values (1)

now from another connection do this

select * from ##temp
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文