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
2
votes
2 answers

transaction rollback error (This SqlTransaction has completed; it is no longer usable)

I am trying to test the first transaction and if it is a SUCCESS, then i try the second one, if the second is also a SUCCESS then i commit both, if the second is a fail, i need to roll back the first. So I have the following function which returns a…
Rezzy
  • 304
  • 6
  • 15
2
votes
1 answer

Sharing transactions between connections

I have a FileShare crawler (getting permissions and dropping them somewhere for later Audit). Currently it is starting multiple threads to crawl the same folder (to speed up the process). In C#, each SqlConnection object has its own SqlTransaction,…
Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93
2
votes
2 answers

in-memory-only modifications to an SQLite database

I'm using perl with an externally supplied sqlite database to pre-generate about 9k pages for a statically-served website. I have some algorithmic improvements to the original data, but for consistency sake, I think it'll make more sense if my…
cnst
  • 25,870
  • 6
  • 90
  • 122
2
votes
2 answers

Is this TRANSACTION being ROLLBACK(ed) for me?

If I cause an error by trying to create an existing table, the existing transaction appears to have already rolled back itself: private void CreateSomeThings() { SqlConnection SqlConn = new SqlConnection(ConnectionString); SqlConn.Open(); …
noelicus
  • 14,468
  • 3
  • 92
  • 111
2
votes
2 answers

Problems occurring when I use Transactions in Stored Procedure

I'm having an SQL related problem which is just pissing me off now :p. Here is my setup: I have 2 Stored Procedures: Parent Stored Procedure is called GenerateAnnualPenalty. GenerateAnnualPenalty has a SELECT CURSOR in it, which iterates over a…
Ahmad
  • 12,886
  • 30
  • 93
  • 146
2
votes
2 answers

how to prevent a transaction to rollback when an error caught in try catch in sql server 2005

I have a table Table1 with records Table1 ------------------------------- ID F1 ------------------------------- 01 1 02 OK 03 52 04 53 05 Null ------------------------------ here I want to change data type of F1 Varchar to Decimal(3,0); then…
Haider Ali Wajihi
  • 2,756
  • 7
  • 51
  • 82
2
votes
4 answers

C# SqlTransaction.Commit throw exception because Connection is null

I have a problem using SqlTransaction. Here's the code SqlConnection conn = new SqlConnection(connectionString); // assume that at this point I add try/catch and the connection is successfully opened. conn.Open(); SqlTransaction trans =…
Minh Vu
  • 211
  • 1
  • 3
  • 10
1
vote
1 answer

mysqli stored procedure and update statement

I have problem in updating mysql table. While the problem seems somewhat strange I'm explaining it below. I am working on user's profile update in which the data from single form is inserting/updating to two different tables but if i update the…
Gautam Arya
  • 723
  • 14
  • 40
1
vote
1 answer

How does SQL Server handle different type of errors?

Please find the below sample code drop table if exists #myTest create table #myTest ( id int, name varchar(30) ) insert into #myTest values (1, 'John'), (2, 'Somu') --select 1/0 …
KnowledgeSeeeker
  • 620
  • 1
  • 9
  • 14
1
vote
1 answer

Problem with creating mysql event. Start transaction error

I what to create an event that delete rows fom a table that are older than 15 minus and add their value back to other table. In the code below mysql said that I have a syntax error on line 5 CREATE EVENT…
anzedolenc
  • 25
  • 4
1
vote
1 answer

How to perform transaction operation in Room database to delete some tables android

I am not familiar with Room Database. I want to clear the data from some tables when I click on button. I have the similar code in IOS but I am not sure where I have to write this method and call this delete function and how to access the tables.…
kartheeki j
  • 2,206
  • 5
  • 27
  • 51
1
vote
1 answer

Is transaction isolation unnecessary in MYSQL when configuring one buffer pool?

According to https://dev.mysql.com/doc/refman/8.0/en/innodb-multiple-buffer-pools.html, buffer pool was protected by its own buffer pool mutex. So there is only one data request can visit buffer pool at the same time. If we have only one buffer…
1
vote
1 answer

encapsulating a Drop and Add constraint in a transaction

I have a simple drop and add a constraint encapsulated in a transaction as follows: begin; alter table movies drop constraint actor_check; alter table movies add constraint actor_check check ( "actor" not like '%Harpo Marx%' and "actor" not like…
Saqib Ali
  • 3,953
  • 10
  • 55
  • 100
1
vote
1 answer

LINQ to SQL not creating Transactions

I've been searching everywhere, to try and get over this issue but I just can't figure this out. I'm trying to make many changes to the DB with one single transaction using LINQ to SQL. I've created a .dbml that represents the SQL Table, then I use…
1
vote
3 answers

Conditional SQL Trigger?

i need to create an Update Trigger, that will only work when my record's status is different then the last status recorded. so i have this right now: for UPDATE AS begin try INSERT INTO tblHistorySource(*) select * from [DELETED] end try but i…
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129