1

I have a scenario where a Multithreaded .net application calls a stored procedure which in turn uses a temp table in it.

In our application concurrently we are calling four threads which individually triggers the same stored procedure. In this stored procedure we are creating the temp table using the INTO keyword.

SELECT * INTO #TempTable

But the application was getting locked and the second thread was no longer completing. Then we tried replacing the Temptable with a table variable and we succeeded in this attempt. But I am not convinced with the table variable since I am looking at huge data volume. Can anyone have any approach to get around this.

Prakazz
  • 421
  • 1
  • 8
  • 21
  • Your "temp table" - it is a `#TempTable`? or is it a regular table that you are treating as transient and blocking while in use? If the latter: yeah, that'll be terrible for concurrency – Marc Gravell Dec 08 '17 at 10:26
  • what is causing the locking? assuming this is sql server, have you looked at sp_who / sp_who2 to see what is blocking what? – Marc Gravell Dec 08 '17 at 13:05

0 Answers0