?
Solved

# vs ##

Posted on 2013-10-24
2
Medium Priority
?
149 Views
Last Modified: 2013-10-24
1)
when a stored proc uses a temp table, and that sp will be hit by 10s of users at the same time, which is more preferred for temptables - # or ##?

2)
which is better for indexing? # or ## tables?
0
Comment
Question by:25112
[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
2 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 400 total points
ID: 39596701
why not create a permanent table then? your sp wouldn't to handle table creation, indexes, ...
0
 
LVL 5

Accepted Solution

by:
MohitPandit earned 1600 total points
ID: 39596775
Hello,

1. For concurrency you need to use Local temp table only i.e. (#) NOT Global temp table (i.e. ##).
Please note, if you will use ## then DB engine will give an error in case concurrent execution same procedure by multiple users
There is already an object named '##...' in the database

2. Indexes performs same on both.

You may also take a look over this link
https://www.simple-talk.com/sql/t-sql-programming/temporary-tables-in-sql-server/

Kindly take a look over it and let me know in case you have any concern.

Best Regards,
Mohit Pandit
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

764 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