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
1
vote
1 answer

SQL Server : is there any performance penalty for wrapping a SELECT query in a transaction?

As learning exercise and before trying to use any ORM (like EF) I want to build a personal project using ADO.NET and stored procedures. Because I don't want my code to become a mess over time, I want to use some patterns like the repository and UoW…
eddy
  • 4,373
  • 16
  • 60
  • 94
1
vote
2 answers

How to retrieve count of records updated in table using SQL Server?

My task is to show the count of items delivered by the shopkeeper[user Id] for the last one hour. Below are the table designs [Order parent table][Order child table] Order parent table: Child table: Items are scanned by using barcode reader, once…
Anjali
  • 1,680
  • 4
  • 26
  • 48
1
vote
0 answers

SQL simple nested select query is getting blocked

In the system I'm using the below query in order to get a portion of my table's data in order to implement pagination. The table contains around 100 records only right now but it will grow into 1 million+ records later on. SELECT Id AS…
arash moeen
  • 4,533
  • 9
  • 40
  • 85
1
vote
1 answer

Using multiple db connections causes deadlock

To resolve the issue mentioned here. We are creating and using 2 same JDBC Singleton Connections(Regular, Proxy). But by doing so we are facing deadlock when we try to use both connections consecutively on same table for doing multiple inserts and…
suraj_fale
  • 978
  • 2
  • 21
  • 53
1
vote
1 answer

JDBC Transaction control in Sybase

Need help in JDBC transaction control mechanism in JAVA. Issue: There are certain stored procedures in our Sybase DB that needs to be run on Unchained mode. Since we are updating our data on two different databases (unfortunately, both Sybase) we…
suraj_fale
  • 978
  • 2
  • 21
  • 53
1
vote
1 answer

Linq2Sql Change Tracking Not Working

I'm running the below code to update some records based on a bank transaction history file that is sent to us each morning. It's pretty basic stuff but, for some reason, when I hit the end, dbContext.GetChangeSet() reports "0" for all…
Mike U
  • 709
  • 6
  • 11
1
vote
1 answer

Stored procedure don't fire some time

I have a stored procedure SetMonthlyGroup (code shown below), but there is a little big but not complex it just repeat for each of @Accounts set @Amount in each month repeat for all @monthCount By the way I tested it and it works. ALTER PROCEDURE…
1
vote
2 answers

PHP PDO There is no active transaction

I tried to run a query with PDO class and got this error message: "There is no active transaction" when trying to commit. Here's my code: public function runExQuery($sql) { $preparedQuery = $this->connect()->prepare($sql); …
GRTZ
  • 330
  • 6
  • 17
1
vote
1 answer

Android Database Transactions Error handling

If I am executing a set of queries using transaction, and one of the queries failed to insert/update/delete. What will happen? Will the remaining queries continue executing by default?
Rashad.Z
  • 2,494
  • 2
  • 27
  • 58
1
vote
1 answer

Queries and triggers execution order inside transaction

If trigger have been invoked inside of transactions is it guaranteed that all of the triggers (non-constraint/non-deferred triggers) will be finished before start of next query in transaction. For example I have following table: Table a id name …
sunprophit
  • 1,639
  • 4
  • 16
  • 39
1
vote
2 answers

Child Parent Transactions roll back

I have a scenario in which I have to process multiple .sQL files, every file contains 3-4 insert or Update queries, now when any query in a file fails I do rollback whole transaction means whole file we be rolled back , and all other files executed…
user1764351
  • 225
  • 1
  • 3
  • 12
1
vote
2 answers

sqltransaction insert a double record while insert data

I am using that sqltransaction for the insert multiple tables each data. But I have problem that have the database have the two same data. What should I do for solve that problem? please help me? Thanx SqlConnection baglanti = system.baglan(); …
user3630521
  • 35
  • 1
  • 11
1
vote
1 answer

Multiple mysqli prepared statements with transactions

I'm trying to figure out how to use sql transactions with mysqli prepared statements. I haven't been able to find any examples that use multiple prepared statements (that aren't OO), so I'm not really sure how to use transactions with them. This is…
qwigoqwaga
  • 37
  • 8
1
vote
0 answers

How to determine if a transaction has already started in SqlConnection?

I am using a SqlTransaction in my code. In my previous post I was having issue when one connection is having transaction lock with IsolationLevel.ReadUncommited then how do I create another connection without lock. (How do create the transaction for…
Shell
  • 6,818
  • 11
  • 39
  • 70
1
vote
3 answers

Two table insert with SQL transaction

How to implement two table insert code with SQL transaction at front end? I have two tables, TblMaster and TblSub. If Tblsub insert fails, then TblMaster record should be roll back. I have a common function ExecuteNonQuery in SQL helper class for…
user2126132
  • 13
  • 1
  • 4