Solved

Temp Tables # or ## - what is the difference??

Posted on 2007-03-31
1
143 Views
Last Modified: 2010-03-19
What is the difference between temporary tables prefixed with # and ## in sqlserver 2005
0
Comment
Question by:Fraser_Admin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 24

Accepted Solution

by:
DBAduck - Ben Miller earned 500 total points
ID: 18830748
# is for connection specific or SCOPE temp tables and ## is a global temp table which means that other scopes have access to the table.

Most of the time you would be dealing with # temp tables because it would be a very interesting thing to have a ## table and have many different connections using it.  But for specific reasons in a specific use, the ## is available in triggers, etc. and for a controlled use, it could be helpful.

Hope that helps.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

696 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