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

Keep log table inserted data in SqlTransaction Rollback C#

I am using SqlTransaction to BulkCopy data to a table in SqlServer database. There are several stored procedures which are called based on column values in inserted table. If there is any error, I am using Rollback to avoid dirty data in tables. I…
Nikhil Chavan
  • 1,685
  • 2
  • 20
  • 34
0
votes
2 answers

phpBB sql transaction function not working

I'm using phpBB and this code is not working as expected. It's simply using the phpBB sql_transaction function to start an sql transaction, then commit it. But the exception should be thrown half way through and issue a rollback using the same…
Captain Hypertext
  • 2,446
  • 4
  • 27
  • 36
0
votes
2 answers

Multiple Roll back for single Transcation

I have to update multiple number of rows in table. My requirement is, If for any reason , the update result returns 0, then the entire transaction should be rolled back. At the same time if there is any exception occurred, then also the complete…
Bimzee
  • 1,138
  • 12
  • 15
0
votes
0 answers

Passing data from stored procedure to a VBScript

I have a stored procedure which among all the data get a date range from a website form. This stored procedure is calling a vbs I created which is supposed to unzip some files where their naming is based on the date they were created. The question I…
keikoku92
  • 151
  • 8
0
votes
0 answers

PL/SQL FOR UPDATE lock inconsistent and invisible for other sessions

I've written a simple cursor which locks a specific row for update. Under a large amount of attempts for multiple threads it appears that the lock does not work and other threads are able to update the locked row. As if they are not required to wait…
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124
0
votes
1 answer

Duplicate Insert in transaction

I have scenario in which I got multiple records inserted into the Table even the checks are implemented, I explain the flow of the code below. BEGIN Transection; var model = select id from table1 where outlet_code = 123 and survey_id = 5 if(model){ …
muneeb
  • 83
  • 9
0
votes
1 answer

MySQL check for active transaction inside trigger

I want a trigger on a table to fail if a transaction isn't active. I've tried to used the autocommit variable, but it apparently isn't affected by START TRANSACTION so it will in my case always be 1 anyway. I want to do something like: IF…
Atle
  • 1,867
  • 12
  • 10
0
votes
1 answer

Does longer transaction to a database impact other database?

I have a fundamental question but unable to find precise information online. I opened up a DB transaction (SQL Server) and making multiple inserts, updates, delete etc; the entire process takes about 5 hours to complete (Due to the volume of Data;…
0
votes
0 answers

Database size increase inside a transaction

I am using an SQLite database. I am inserting many rows in it, with insert statements inside a transaction. However, I noticed (with step-by-step debugging) that before I commit the transaction, my database file increase in size, which means that…
Sithered
  • 481
  • 7
  • 23
0
votes
0 answers

Why must we avoid the "nonrepeatable read" in transaction database?

As we all know, there are usually 4 kinds isolation levels in transaction database: Read Uncommitted, Read Committed, Repeatable Read and Serializable. Repeatable Read and Serializable can avoid Nonrepeatable Read. Such as, Transaction_1 has two…
egraldlo
  • 183
  • 2
  • 11
0
votes
1 answer

Transaction Handling VB.Net

I have a program that inserting records to DB in 2 queries.And I'm handling the transaction there. But my transaction is not working. After executing first statement , if I close the program records will insert the first table and not inserting to…
Tom
  • 1,343
  • 1
  • 18
  • 37
0
votes
1 answer

CommandBuilder and SqlTransaction to insert/update a row

I can get this to work, but I feel as though I'm not doing it properly. The first time this runs, it works as intended, and a new row is inserted where "thisField" contains "doesntExist" However, if I run it a subsequent time, I get a run-time error…
KarlHungus
  • 237
  • 4
  • 13
0
votes
3 answers

T-SQL - Incorporating Try-Catch and Error-Handling (Transactions)

I am working on a Transaction using Repeatable Read Isolation Level. I want to incorporate both Try-Catch and an Error-handler features in this Transaction. When I run the code, I get an error message that : Msg 102, Level 15, State 1, Line…
Exceli
  • 47
  • 1
  • 6
0
votes
1 answer

How do i use SqlTransaction across multipe methods

Let's assume we have an Object A which can be deleted an Object B which hold a forendkey from A If you want to deleted A, you have to delete the forendkey from B first and then you can delete A but if something goes wrong it should be rolled back…
WiiMaxx
  • 5,322
  • 8
  • 51
  • 89
0
votes
1 answer

How i can convert format date to d/M/yyyy and convert format time to h:mm:ss AM in SQL

I have created a field of type datetime. I want to display this in YYYY/M/D format example date 09/09/2014 to display as 2014/9/9 Also I need display a time field [Time_Orde] in this format 2:43:14 PM I use SQL server 2008 I have tried the…
Sherif Hamdy
  • 587
  • 6
  • 10