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.
214 questions
0
votes
1 answer

Multiple transactions on the same table, at the same time

I am running into a problem which I have a table that can be edited by many thread, each thread creates a transaction to work with this table, if a transaction takes so long to complete, other threads will throw the exception "Query Timeout…
stoney78us
  • 185
  • 1
  • 5
  • 16
0
votes
1 answer

MySql: Transactional safety when inserting rows

I want to execute the following two MySQL statements: 1) SELECT * FROM table1 WHERE field1=val1 FOR UPDATE; 2) UPDATE table1 SET field2=val2 WHERE field1=val1; It is important that the second statement exactly changes the rows returned by the first…
Heinzi
  • 4,834
  • 3
  • 31
  • 57
0
votes
1 answer

SQL Transaction with Parameters

I am using a SQL Transaction statement to execute a stored procedure. Traditionally, I would use command parameters to insert different variables into the command. When I tried to use the same method with a Transaction, the procedure would not…
TheGeekZn
  • 3,195
  • 7
  • 43
  • 85
0
votes
2 answers

How to use transactions in multiple SQL procedures?

I would like to start a transaction through a sql procedure, run other 2 procedure, and then run the first procedure with command: 'commit'. Do you believe that this could be possible? I tried but received an error. Transaction count after EXECUTE…
Alexa Adrian
  • 1,552
  • 2
  • 20
  • 36
-1
votes
1 answer

Problem in reading the database collation into a variable in SQL Server

I've faced this strange thing that I can't set the value of a variable to a result of a query. The query is reading the collation of a database and works fine by itself: SELECT collation_name FROM sys.databases WHERE [name] = 'my_DB'; And the…
Iraj
  • 107
  • 12
-1
votes
1 answer

PowerShell to MySQL : SQL statement after the COMMIT is also committed

I am inserting values from PowerShell into MySQL table. I have 2 Insert statements (insertQuery1,insertQuery2) in transaction. There is COMMIT after insertQuery1 so changes in query_1 is committed but there is no is COMMIT after insertQuery2 yet…
sql_dummy
  • 649
  • 5
  • 18
-1
votes
1 answer

Is mixing transactions and table locks unrealistic in MySQL 5.7?

I am looking to mix table locks and transactions in an API. I have selected MySQL 5.7 as the storage engine, though I am not particularly committed to any specific RDBMS. I am interested in seeing whether my current design is suitable for MySQL…
halfer
  • 18,701
  • 13
  • 79
  • 158
-1
votes
2 answers

SQL: Is it possible to insert into two tables at the same time with autogenerated id output from first table into second

My database contains two tables FileStore and FileRepository. The FileStore table contains 3 columns Id (autogenerated uniqueidentifier), FileName and Description -> In Initial state with demo data The FileRepository table contains 3 columns Id…
Suraj Nair
  • 456
  • 1
  • 6
  • 23
-1
votes
2 answers

How to union multiple select statements while they are not near together?

I have an sql query which check for existence of some records, if those records exist rise error for them otherwise insert them to database. In my query as I need to return error messages for every record, I need to select some custom texts, problem…
Pouria Moosavi
  • 529
  • 2
  • 17
-1
votes
1 answer

c#: How to delete a newly inserted record which is not committed by a transaction

I want to delete a record which is inserted in the previous step inside one transaction. The transaction is created without any isolation level defined. Currently, no record is deleting by delete statement.
csharp coder
  • 19
  • 2
  • 4
-1
votes
1 answer

sql transaction error

I am very new to SQL. I am at a loss as to what my problem is. Any help would be greatly appreciated. START TRANSACTION; UPDATE hsitems SET price = price *2 WHERE partID = AX12; COMMIT; 1054 - Unknown column 'AX12' in 'where clause'
-1
votes
1 answer

Scheduling a SQL Job

what is the best way to schedule a SQL Job to run from (any date range) i.e. 15th to 18th every single month with no end date? Thanks in advance. john
John
  • 51
  • 1
  • 8
-1
votes
1 answer

SQL Transaction with large amount of .NET code

I've written an shop floor application which deals with manufacturing process. However, over few months it's increased and increased in size and now I really need to add good amount of error handling This is an simplified version of the logic…
Paul
  • 256
  • 4
  • 16
-1
votes
2 answers

Which statements belong to a transaction in SQLite 3?

I'm planning to write a multi-threaded application that uses SQLite 3 to communicate with a database. It is planned that the database is concurrently read and written by multiple threads. One of the things I want to do is executing a series of…
fuz
  • 76,641
  • 24
  • 165
  • 316
-1
votes
1 answer

How to lock rows for update and then update a table using a variable in MySQL

I have a purchasing table that stores all orders that a store receives. In some cases, I have to re-order the an item at a different cost. When I make a sale transaction, I need to be able to determine the total cost of the item sold using FIFO…
Jaylen
  • 33,621
  • 35
  • 108
  • 193
1 2 3
14
15