SQL doest中的tempery表存在所需的时间 [英] Tempery table in SQL doest exists for desired time

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

问题描述

我已经从特定数据库的表创建了一个全局临时表。我已经从sp创建它并被另一个sp调用,我从控制台应用程序调用这些过程,而我用断点检查它,第一个表是已创建但无法被其他sp访问。

解决方案

临时表会持续会话的生命周期,因此如果要发出两个单独的SqlCommands来处理存储过程,那么第二个临时表将不存在。



有全局临时表,但我强烈建议不要使用它们 - 因为它们当时被所有实例共享,如果你有两个不同的用户影响它们会变得......令人困惑......当你使用数据时。



如果有更好的答案,我们需要查看你的控制台代码和你的两个的SP

I have created a global temporary table from tables of a particular database.I have created it from an sp and called by another sp,I call these procedures from a console application ,while I check it with break point ,first table is created but it cannot be accessed by another sp.

解决方案

Temporary tables last for the lifetime of the session, so if you are issuing two separate SqlCommands to action your stored procedures, then the temporary table will not exist for the second one.

There are Global Temporary tables, but I would strongly advise against using them - as they are shared by all instances at the time, and if you have two different users affecting them it will become...confusing...when you use the data.

For any better answer, we would need to see your console code, and your two SPs


这篇关于SQL doest中的tempery表存在所需的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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