加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – SQL Server多用户中的临时表是否安全?

发布时间:2020-12-12 06:53:00 所属栏目:MsSql教程 来源:网络整理
导读:是线程本地的临时表还是服务器的全局临时表? 解决方法 #temp是会话范围 ## temp是服务器范围 MSDN: Local temporary tables are visible only in the current session,and global temporary tables are visible to all sessions … A local temporary table
是线程本地的临时表还是服务器的全局临时表?

解决方法

#temp是会话范围
## temp是服务器范围

MSDN:

Local temporary tables are visible
only in the current session,and
global temporary tables are visible to
all sessions

A local temporary table created in a
stored procedure is dropped
automatically when the stored
procedure is finished. The table can
be referenced by any nested stored
procedures executed by the stored
procedure that created the table. The
table cannot be referenced by the
process that called the stored
procedure that created the table.

All other local temporary tables are
dropped automatically at the end of
the current session.

Global temporary tables are automatically dropped when the session that created the table ends and all other tasks have stopped referencing them. The association between a task and a table is maintained only for the life of a single Transact-SQL statement. This means that a global temporary table is dropped at the completion of the last Transact-SQL statement that was actively referencing the table when the creating session ended.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读