多线程中的临时表 [英] Temporary table in multithread

查看:290
本文介绍了多线程中的临时表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多线程应用程序.

I have a multithread application.

每个线程执行存储过程,并在其中创建本地临时表. 临时表的名称是相同的:#TempTable

Each thread executes store procedures in which I create a local temporary table. The name of the temporary table is the same : #TempTable

当他们操纵此#TempTable

如何为每个具有相同名称的线程创建一个#TempTable?

How can I make a #TempTable for each thread with the same name ?

推荐答案

您需要确保每个线程在与connectio npool不同的连接中运行(因此它在不同的会话中).

You need to ensure each thread is running in a different connection from the connectio npool (so it is in a different session).

临时表仅在其自己的会话中可见.

Temp tables are only visible in their own session.

来自 MSDN :

本地临时表仅在当前会话中可见

Local temporary tables are visible only in the current session

这篇关于多线程中的临时表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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