Questions tagged [sqltransaction]

An SQL-transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order. Executing SQL-statements in Transactions, can ensure data integrity and handle database errors.

An SQL-transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order.

A transaction is the propagation of one or more changes to the database. For example, creating, updating, or deleting a record from the table. Transactions are used to ensure data integrity and to handle database errors, by collecting SQL queries into a group and executing all of them together, as one unit of work.

Properties of Transactions: Transactions have the following four standard properties, usually referred to by the acronym ACID:

  • Atomicity: ensures that all operations within the work unit are completed successfully; otherwise, the transaction is aborted at the point of failure, and previous operations are rolled back to their former state.
  • Consistency: ensures that the database properly changes states upon a successfully committed transaction.
  • Isolation: enables transactions to operate independently of and transparent to each other.
  • Durability: ensures that the result or effect of a committed transaction persists in case of a system failure.
233 questions
0
votes
0 answers

Snowflake | retain stream data in case of failure

We want to use a stream to insert data from a source table to multiple target tables. For that purpose, we have created steam on the source table. We are using a Java script procedure for this. We are inserting stream data into a temporary table…
YogeshR
  • 1,606
  • 2
  • 22
  • 43
0
votes
1 answer

When are go goose transactions committed?

I have some code that needs to be run in a Tx like here I generated a go sql migration as mentioned here in the official docs for go goose my questions are: when are these transactions actually committed to the database? I forced the migrations…
AthulMuralidhar
  • 662
  • 1
  • 9
  • 26
0
votes
0 answers

Understanding SQL Transaction Handling

We have a scenario were sporadically UpdateStatement1 works but UpdateStatement2 and UpdateStatement3 does not execute. Since stored procedure UpdateDataSP is part of Database transaction Scope, no other process can update the Table1 until this…
Ram
  • 147
  • 3
  • 11
0
votes
1 answer

How to make MySQL's start transaction query fail?

I can see in the PHP documentation that begin_transaction can fail. How can I make it fail? (All of my tables use the InnoDB engine. MySQL version 5.7.38-log.) Why do I care? I'm investigating a programming error in a system that does not check…
0
votes
0 answers

Skip record while bad query instead aborting current transaction - odoo13

while reading from remote file, which gives me data in form of dict with key. Then am trying to create record by looping. Also, the table has _sql_contrain. So whenever the bad query happens, I want to skip the line instead aborting entire…
NinjaBat
  • 370
  • 4
  • 20
0
votes
1 answer

Snowflake update statements locks the entire table and queues other update statements

We have a use case where we need to execute multiple update statements(each updating different set of rows) on the same table in snowflake without any latency caused by queuing time of the update queries. Currently, a single update statements takes…
0
votes
0 answers

Is there any way to Set TRansaction scope to complete DB with options to rollback commit

I have a requirement to perform some action and if something goes wrong I want all my data which was changed via multiple API to get reverted back so is there any way to Set the Transaction scope to complete DB such that Begin transaction is set at…
ksk
  • 165
  • 14
0
votes
1 answer

How to manage multiple transactions in SQL Server 2005

I'm developing a desktop application in C# with a SQL Server 2005 backend. I want to insert rows into two tables, in table1 one row will be saved and in table2 more than 100 rows will save at a time. I want that while saving is going on and between…
Haider Ali Wajihi
  • 2,756
  • 7
  • 51
  • 82
0
votes
1 answer

Query Error Handling in MySQL Transaction Statement

I am taking a Database Design & Development course, and I just learned about SQL transactions. The textbook (Learning SQL 3rd Edition by Alan Beaulieu) is really good at explaining how things work, but isn't very good at giving examples of the…
Jacob Hornbeck
  • 398
  • 2
  • 19
0
votes
2 answers

Node.js MS SQL transaction

Can anyone help to implement MS SQL transactions in Node.js . I am try to execute multiple stored procedures inside a promise. Method 1 const executeProcedure = async (data1, data2) => { try { // sql connection let dbConn = new…
Kmss
  • 13
  • 1
  • 5
0
votes
2 answers

Is it necesserly to use sqltransaction with using keyword in C#

I have following with two using block: using (SqlConnection connection = new SqlConnection(_connectionString)) { String query = "query..."; using (SqlCommand command = new SqlCommand(query, connection)) { …
ElConrado
  • 1,477
  • 4
  • 20
  • 46
0
votes
3 answers

SQL Triggers - Deleted or Updated? or maybe something else?

I am trying to figure out which i need to use here: deleted, inserted or updated. basically. I need to write some data to the history table, when the main table is updated, and only if the status changes from something to either pending or…
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
0
votes
2 answers

Does INSERT INTO with Subqueries run as a single transaction (thread safe)?

I have an insert query with subqueries which i want to run on a Postgres database. But i'm not sure if the query with its subqueries run in a single transaction. We have two entities 'configs' and 'config_versions'. A 'config' can have multiple…
0
votes
1 answer

How to write a Mysql transaction within a static JS-method?

I have this static method that executes a SQL statement: static save(habit){ return db.execute( 'INSERT INTO habits (name, repeatVal, notification, color, question, id) VALUES (?, ?, ?, ?, ?, ?)', [habit.name, habit.repeatVal,…
be2021
  • 29
  • 6
0
votes
1 answer

PostgreSQL concurrency in transactions

I want to understand how transactions work in SQL, specifically in PostgreSQL Imagine I have a very large table (first_table) and the query below lasts 2 seconds and I execute the query below via psql. sudo -u postgres psql -f…
Eduardo G
  • 370
  • 4
  • 17