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

  • SEARCH
  • Home
  • 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 8650781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:54:17+00:00 2026-06-12T13:54:17+00:00

I have 2 tables (A,B), and 1 query My query is something like this

  • 0

I have 2 tables (A,B), and 1 query

My query is something like this

  1. Read From A
  2. Update B with this data from A
  3. Using the updated table B, set final value of A.

Example execution can be find in below question:
Proper way to keep a single data in sql server?

Now since all the process is connected, this query should not be executed twice at the same time, or by 2 different users until the process ends. How do I prevent this ? Or does it already work securely like this?

  • 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-06-12T13:54:18+00:00Added an answer on June 12, 2026 at 1:54 pm

    Use transaction lock :

    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    
    BEGIN TRANSACTION
    
    --select * from A
    -- update B ....
    --update A
    
    WAITFOR DELAY '00:00:02'   -- tables remain locked for 2 secs   hh:mm:ss
    
    commit TRANSACTION
    

    during the transaction execution, any try to read or write from/to tables will timeout…

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

Sidebar

Related Questions

I have tables linked by FK, I query on the first table using entity
I have 2 tables which I want to query from. The first table (lets
I have a simple query where in FROM I've got something like: WHERE ([Comment]
I'm working on a query where I pull data from multiple tables using left
I have a table which represents a line-by-line dump of the data read from
So I have two tables students (PK sID) and mentors (PK pID). This query
My SQL table is something like this: id, name, value1, value2, value3, value4 1,
I'm new to using R and I'm trying to find something from a table.
I have three tables of concern and a query which generates the following output
I have some tables that I'm joining in a query with Postgres (9). However,

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.