Question : how multi threading works in sql 2005?

Hi,

I don't know much about multi-threading in sql 2005. Please any inputs will be greatly appriciated.

I have the stored proc that is in the code snippet section. It recieves 3 parameters and the following is how I would call the stored proc:
        exec GetDrillDownFields2 1, 2,  'AND pd.[CORE] = ''WINDSOR'''


Please, assume I have many annonimous users using an ASP.NET 2005 application. All of these users are hitting a stored proc symultaneously, please, see code snippet. My question is, would the global table  ##DrillDownProcessorTable1  exist for each user hitting the stored procedure? or would the stored proc lock itself and wait until an user has finished using this resource and then allow another user to have acces to the stored proc and create the global table ##DrillDownProcessorTable1?
Please, remember that all the users using the stored proc are anonimous users.

Thanks.  



Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
 
ALTER PROCEDURE [dbo].[GetDrillDownFields1]
(@DepartmentID VARCHAR(30), 
 @CategoryID VARCHAR(30),
 @DrillDownClause VARCHAR(3000)
)
AS
 
DECLARE @DrillDownTable NVARCHAR(4000)
 
SET @DrillDownTable = '' +
	N'SELECT pd.Core, pd.[Multy-Core], pd.HT, pd.FSB ' +
	N' INTO ##DrillDownProcessorTable1  ' +
	N'FROM Items AS i  ' +
	N'   INNER JOIN ItemCategory AS ic ' +
	N'     ON i.ItemID = ic.ItemID ' +
         N'   INNER JOIN Categories AS c ' +
	N'     ON c.CategoryID = ic.CategoryID ' +
	N'   INNER JOIN Departments as d ' +
         N'     ON d.DepartmentID = c.DepartmentID ' +
	N'   INNER JOIN ProcessorsDetail AS pd ' +
	N'     ON i.ItemID = pd.ItemID ' +
	N'WHERE d.DepartmentID =  ' + @DepartmentID + ' AND ' +
	N'      i.Discontinued = 0 ' +
	  @DrillDownClause
 
exec sp_executesql @DrillDownTable
                
SELECT * FROM ##DrillDownProcessorTable1

Answer : how multi threading works in sql 2005?

thanks, I made this change and it worked.
Random Solutions  
 
programming4us programming4us