# vs ##

Posted on 2013-10-24
Medium Priority
Last Modified: 2013-10-24
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 ##?

which is better for indexing? # or ## tables?
Question by:25112
LVL 71

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, ...

Accepted Solution

MohitPandit earned 1600 total points
ID: 39596775

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

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

Best Regards,
Mohit Pandit

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

627 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