Solved

# vs ##

Posted on 2013-10-24
2
142 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
2 Comments
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 100 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 400 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now