Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:25:19+00:00 2026-05-27T18:25:19+00:00

I have a table where new data gets filled each time a user clicks

  • 0

I have a table where new data gets filled each time a user clicks an option on my website. I created this table via Management Studio and I want to clarify that neither I am creating this table each time via stored procedure nor I am using any type of in-memory temporary tables.

Whenever user clicks an option on my website, old records from this table are deleted first and new records are filled. I am worried about the concurrency issue that may arise when many users click the same option from my website. I am not aware of how SQL Server is going to handle multiple delete and inserts into this table.

I read somewhere that SQL Server Services automatically handle this issue with a separate session-wise copy of the table for each session.

Is there a need to add SPID in my table or it is automatically taken care of? Do I need to change the isolation level from Read Committed to Serializable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:25:20+00:00Added an answer on May 27, 2026 at 6:25 pm

    The general answer to the question you’re asking is that yes you will need to have some sort of session identifier column in your table and pass the value in it for each user/session along to all stored procedures and/or SQL statements that operate on that table.

    The alternative is that yes, you could set the isolation level to Serializable and have your users queue up one behind the other waiting until everyone in front of them is done and let SQL Server handle it, but that’s almost never what you want to do.

    So roughly, for the first option, you’ll end up with something like :

    YourTable

      ID     DataCol1    DataCol2   DataCol3 .... User/SessionID
    

    So a User logs in/starts a Session on your site. You use their ID or generate a SessionID for them and pass it to

    StoredProc1ClearSession @UserSessionID      
    StoredProc2InsertNewData  (AnyOtherParamsYouHave),@UserSessionID
    StoredProc3RetrieveData   (AnyOtherParamsYouHave),@UserSessionID
    

    you get the idea.

    Basically as long as every SQL statement you use to touch the table has as part of the WHERE clause or insert statement:

    UserSessionID or @UserSessionID
    

    then you’re probably well on your way to having a table that can be safe shared by several users at the same time as you described.

    For the second option, please
    read this so you realize what you’re getting yourself into. 🙂

    Then put code like this

    CREATE PROC yourstoredproc
    paramaterslisted
    AS
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
    BEGIN TRANSACTION;
    
    YOURCODE TOUCHING TEMPTABLE HERE
    
    COMMIT TRANSACTION;
    

    Just in case you don’t read the link:

    SERIALIZABLE
    Specifies the following:

    This blocks other transactions from updating or inserting any rows that would qualify for any of the statements executed by the current transaction. This means that if any of the statements in a transaction are executed a second time, they will read the same set of rows. The range locks are held until the transaction completes. This is the most restrictive of the isolation levels because it locks entire ranges of keys and holds the locks until the transaction completes. Because concurrency is lower, use this option only when necessary. This option has the same effect as setting HOLDLOCK on all tables in all SELECT statements in a transaction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with data exactly like this: ID Heading Description Time Location
I have a table into which new data is frequently inserted. I need to
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have created a new table including a column note. The default is varchar(255)
I am new to iPhone development. I have created a table view in a
I have some C# code that looks something like this System.Data.DataRow row; var table
I have a gridview that gets its data from a webservice. This comes into
I have a dropdown list where it gets the data from a table called
I have a new clustered database and I've been moving data into the tables
Most of my content is in a new table I have added to JOOMLA

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.