Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

temp table belongs only to @@SPID?

Posted on 2011-02-25
6
Medium Priority
?
309 Views
Last Modified: 2012-06-21
I created a temp table, but another user is not able to go to tempdb and see the table- how can I  help her to see the table?

thanks
0
Comment
Question by:anushahanna
  • 3
  • 3
6 Comments
 
LVL 41

Accepted Solution

by:
ralmada earned 2000 total points
ID: 34980432
No, I don't think that's possible. I would suggest you create a regular table if you want multiple users to access it.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 34980572
OK- so even though it is in tempdb, it will show up only in the original SPID - if you happen to close that window, then even the author can never reach it?
0
 
LVL 41

Assisted Solution

by:ralmada
ralmada earned 2000 total points
ID: 34980803
Yes, that's right. One the session is closed, you cannot retrieve it.

Just to clarify, you have two types of temp tables. local temp tables, that are only accesible in the module it was created, and global temp table that are accessible only in the session that creates them. That means that no other sessions (for example another user logged in) can access it.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:anushahanna
ID: 34982654
you  mean #temp and ##temp, right? ## is global?
0
 
LVL 41

Expert Comment

by:ralmada
ID: 34982736
yes, that's right :)
0
 
LVL 6

Author Comment

by:anushahanna
ID: 34982819
thanks as always, ralmada.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question