存储过程中的临时表 [英] Temporary tables in stored procedures

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

问题描述

我一直想知道 sp 中的临时表以及所有这些如何影响并发性.SP 在 MSSQL 08 服务器上制作.

I have been wondering about temp tables in sp's and how all that can effect concurrency. SP made on a MSSQL 08 server.

如果我有一个 SP,我在其中创建了一个临时表并像这样再次删除它:

If I have a SP where I create a temp table and drop it again like this:

BEGIN

CREATE TABLE #MyTempTable
(
   someField int,
   someFieldMore nvarchar(50)
)

... Use of temp table here
... And then..

DROP TABLE #MyTempTable

END

这个SP会被非常频繁地调用,所以我的问题是这里会不会出现并发问题?

This SP will be called very very often, so my question is can there ever occur concurrency issues here?

推荐答案

不.每个连接都会创建临时表的独立实例.

Nope. Independent instances of the temporary table will be created per each connection.

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

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