Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Concurrency for temporary table

Author  Topic 

vermorel
Starting Member

26 Posts

Posted - 2008-02-04 : 12:33:38
I am using a local temporary table within a SQL query triggered within the codebehind code of an ASP.NET page. Obviously, this is a situation where the codebehind can obviously be executed in a concurrent manner.

I think this raises a concern for concurrency issues with the local temporary table (.NET connection pooling?). Could anybody confirm that this is indeed an issue?

What do you suggest to solve the problem?
- use a "lock" to make is non-concurrent (does not seems very scalable to me)
- use a unique session for each SQL query

Thanks in advance,
Joannès
http://www.lokad.com sales forecasting

Hommer
Aged Yak Warrior

808 Posts

Posted - 2008-02-04 : 13:39:33
You sound like using embedded t-sql in asp. Normally that is a no no.

That is the need for your temp table, assuming you are talking about the db term, instead of html table?

Ideally, your call to the db should be atomic and stateless.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-02-04 : 23:03:23
Local temp table is only available to session that creates it and can't share with other sessions, so shouldn't have concurrency issue.
Go to Top of Page

vermorel
Starting Member

26 Posts

Posted - 2008-02-05 : 05:32:16
quote:
Originally posted by rmiao

Local temp table is only available to session that creates it and can't share with other sessions, so shouldn't have concurrency issue.



From C#/.NET, the SQL query gets executed from a SqlCommand instance. The SqlCommand constructor takes a connection and transaction as parameters.

Could anyone give me a pointer about the notion of SQL "session"? How does it work from the .NET developer viewpoint?

Thanks in advance,
Joannès
Go to Top of Page
   

- Advertisement -