Click here to Skip to main content
15,891,940 members
Everything / Transaction

Transaction

transaction

Great Reads

by brian_eckert
A proposed template for writing nested stored procedures that perform updates (inserts, updates, deletes)
by Kyriakos Akriotis
How to use TransactionScope in your MongoDB operations.
by DiponRoy
How to use MERGE statements in different databases
by Apriorit Inc, MikeSotnichek
Examples of fixing vulnerabilities in smart contracts

Latest Articles

by DiponRoy
How to use MERGE statements in different databases
by Apriorit Inc, MikeSotnichek
Examples of fixing vulnerabilities in smart contracts
by Kyriakos Akriotis
How to use TransactionScope in your MongoDB operations.
by brian_eckert
A proposed template for writing nested stored procedures that perform updates (inserts, updates, deletes)

All Articles

Sort by Score

Transaction 

24 Jun 2015 by brian_eckert
A proposed template for writing nested stored procedures that perform updates (inserts, updates, deletes)
14 Nov 2018 by Aydin Homay
Hi, As far as I know, you can use Transactional File Manager which is a .NET API that supports including file system operations such as file copy, move, delete, append, etc. in a transaction. However, this API is in fact a wrapper around Transactional NTFS If this did not solve your problem...
9 Nov 2019 by MadMyche
While it is not something I generally recommend; it may just be easiest to use a CURSOR for this application. This is a rough sample of what it could look like, it is up to use appropriate variable types/sizes and to work out what the SELECT statement actually will be; so consider this a...
5 Apr 2015 by Sascha Lefèvre
To put it simply, a database-transaction is exactly that: Locking the database until commit or rollback. It wouldn't make sense if I wrote down here what has been written down many times already; please refer to these links and pay attention especially to the aspect of "Transaction Isolation...
29 Jun 2016 by OriginalGriff
You can't rollback "part" of a transaction - it's all or nothing.Even if you nest transactions, inner level COMMIT instructions are ignored, and inner level ROLLBACK will cause an error: Nesting Transactions[^]To insert a log entry which won't be rolled back regardless of the transaction is...
20 Apr 2018 by Wendelius
Try declaring an exit handler. Something like below. Sorry for any typos, I don't have MySql at hand at the moment DROP PROCEDURE IF EXISTS mprocedure; DELIMITER $$ CREATE PROCEDURE mprocedure () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; SELECT 'An exception...
5 Nov 2018 by OriginalGriff
Simple: you only have one item, and you keep reusing it. Imagine you have an envelope and into that you place cards, each of which contains a letter of the alphabet. You place the letter "A" into the envelope and pass it to your mate who notes down the number on the outside of the envelope....
21 Jan 2019 by CHill60
There is no way we can help you with a problem like this without seeing some sample data. Your expected results would also be incredibly helpful too. Here are some techniques for you to solve your own problem. 1. Simplify your query! A more readable query is a more easily maintained one. For...
15 Mar 2015 by virang_21
I wrote a below stored proc to retrieve work items from database table which is acting as a queue. There are five threads running which is polling table called ReqResp for work to be done and once it picks the work it can update the response back to that record. I have a primary key called SSID...
29 Jun 2016 by Member 7967542
Hi,I want to rollback transaction partially. Actually I have a procedure which does some tasks. I want to log the state of on each step. For this want to insert a row in the log table. In case of any exception I want to know how many steps are executed completely and on which step exception...
5 Sep 2016 by MT_
Hi SQL Gurus,In my stored procedure, I am using transaction and also calling other stored procedure. Some pseudo-codebegin transaction Update TableA set colA = 'Updated' exec SomeotherStoredProc if @@Error=0 Commit Transaction else ...
5 Sep 2016 by Wendelius
If your inside the same transaction then you should see the updated value. Try the following testCREATE TABLE TableA ( ColA nvarchar(100));INSERT INTO TableA VALUES ('Empty');CREATE PROCEDURE ProcB ASDECLARE @currentvalue nvarchar(100);BEGIN SELECT @currentvalue =...
12 Dec 2016 by Alexandros Pappas
I do not understand, how the transaction timeout works in COM+. I have the class ClassComPlus which inherits from ServicedComponent, has transaction timeout attribute set to 1 second, and has a method SubSleep, that sleeps 3 seconds. I expect, the client which calls the method SubSleep to get an...
12 Dec 2016 by Alexandros Pappas
With the help of Microsoft, I finally understood how the COM+ transaction timeout works. The COM+ transaction timeout, is a timeout on the transaction, not on the method call. The method will execute, as long as it has to execute. The moment the first transaction is enlisted, the transaction...
3 Nov 2017 by i_syed2000
I'm trying to understand the concept of transaction messaging on MSMQ as well as transaction support in wcf. For Queues with transaction support, does it mean the following set of operations will be automatic? 1. Client A on Machine 1 writes a row in its application database that message sent...
3 Nov 2017 by Mehdi Gholam
Read the definition : [^] If you read/write to a message queue and do other operations in a transaction, they will all succeed or fail/rollback (so for the queue no enqueue and for writes and no dequeue for reads, and databases commit or rollback etc.).
21 Mar 2018 by ahmed_sa
Problem How to trace this query to know the reason of why it return null records . query below work in database and give me results but not give me any result in another database How to debug or trace it to know why it not give me any result . SELECT TrxInvH.Trxtype, TrxInvH.TrxYear,...
21 Mar 2018 by Maciej Los
Sorry, but your query is... ugly. I counted the following number of occurrences of tables : TableName NoOfFroms NoOfJoins Total Accounts 2 0 2 AllSubLedgerCode 10 6 16 (!!!) TrxInvH 1 0 1 TrxInvF 0 1 ...
21 Apr 2018 by Ahmed AE
I have a transaction that will be applied to 2 tables. Table 2 has field 'image' that is unique. when trying to execute the following code in the first time, it is executed correctly but when trying to Re-execute it again (to show effect of rollback), a duplicate error occurred in table2 and the...
4 Jun 2018 by Bryian Tan
I'm guessing, data issue? Possible one of the SpecialCode value not in ######/# format? Here how I replicate the error. DECLARE @SpecialCode VARCHAR(50) SET @SpecialCode = '012345/' SELECT CAST(CAST(RIGHT(@SpecialCode, CHARINDEX('/', @SpecialCode) - 6) AS NVARCHAR) AS INT) SELECT...
14 Nov 2018 by Ehsan Sajjad
I have a scenario where we need to do multiple operations but all of those should be atomic which includes first writing rows in a table and after that using the Id for those rows writing a file for each of those on a network path and followed by writing to another table rows. What i need here...
12 Feb 2019 by ahmed_sa
problem error on query below conversion fails when converting 5/1 to int DataSample SpecialCode expr1 EXPR2 000151/1 000151 1 000151/2 000151 2 000151/3 000151 3 006495/1 006495 1 006495/2 006495 2 data above not have...
12 Feb 2019 by OriginalGriff
If I extract your code to check, and use your sample data: DECLARE @SpecialCode NVARCHAR(MAX); SET @SpecialCode = '000151/1' SELECT CAST(CAST(LEFT(@SpecialCode, CHARINDEX('/', @SpecialCode + '/') - 1) AS nvarchar) AS int) AS expr1, CAST(CAST(substring(@SpecialCode, CHARINDEX('/', @SpecialCode)+1...
29 Jul 2019 by ahmed_sa
Problem How to select rows from table shippolicyh that have related one row only on table trxfootersafe ? meaning to modify query that get all policycode on shippolicyh that have one row only related on table trxfootersafe . the following query not give me result so that what I change . ...
29 Jul 2019 by Maciej Los
Check this: SELECT * FROM SHIPPolicyH H WHERE EXISTS ( SELECT COUNT (F.SubLdgCode2) FROM TrxFooterSafe F WHERE SubLdgCode2 = H.PolicyCode AND BranchCode = H.BranchCode AND SubLdgCode1=H.Sender and BranchCode=1 and Debit > 0 and Credit=0 and TypeTrxSafeCode=-1 ...
14 Oct 2019 by nagendrathecoder
I am using unit of work pattern for EF core database first approach in my application. I have also implemented database transactions in unit of work class. For e.g. public class UnitOfWork : IUnitOfWork { private myDBContext _dBContext; public IDatabaseTransaction BeginTransaction() ...
3 Nov 2019 by ahmed_sa
this job must run every 20 second for database roomanado exec [xxbb].[NatureOfSuit_Importer] ''\\192.168.20.7\Import\NoOfSuitImporter_input.xlsx + '',''\\192.168.20.7\Import\NoOfSuitImporter_output.xlsx'' i dont need to use schedule wizard i need to execute stored procedure command below every...
3 Nov 2019 by RickZeeland
Maybe this will be helpful: Simple way to create a SQL Server Job Using T-SQL[^] Also I think you are missing sp_add_jobschedule, see example here: command line - How do I create a SQL Server agent without using a GUI? - Stack Overflow[^]
6 Nov 2019 by W Balboos, GHB
Use (or install and use) the SQL Server Management Studio. It has a feature to profile the query and you can see where it's spending its time. Look for (look-out for!) "Table Scans" of large tables - that means it's looking at every single record. In such cases it may make sense to put one or...
9 Nov 2019 by ahmed_sa
problem how to execute stored procedure with every row of temp table ? I need to execute storedprocedurename inputfilepath outputfilepath. this is data exist on database on table Importertemplate. i need to get stored procedure name after execute with two parameters inputfilepath and...
10 Nov 2019 by ahmed_sa
problem I have stored procedure move data by openrowset based on select statement I need to modify stored procedure to prevent repeated data suppose i have on table company on database SQL server 2012 1 mazda 2 toyotal first time Executed stored procedure it show on excel with data above...
10 Nov 2019 by RickZeeland
Use EXISTS to check if the data already exists, see example here: SQL Server IF EXISTS THEN 1 ELSE 2 - Stack Overflow[^]
2 Dec 2019 by ahmed_sa
I work on sql server 2012 and i need to get top 10000 revision_id and count parts related that having highest parts from parts.Rohs ? this table have one million rows of parts but parts are repeated . so that i need to count parts related to every revision it then get top 10000 have counts ...
17 Dec 2019 by OriginalGriff
What you probably mean is that it isn't updating - because you don't Commit the transaction within that code - so regardless of whether your code calls Rollback or not, the transaction will immediately Rollback when the Connection object goes out of scope. Check your DB carefully - I suspect...
17 Dec 2019 by MadMyche
I'm using your DLL to use a databaseMySQL in my C# project What DLL are you using and where did it come from? If you found attached to an article that has been posted here it is best to contact the author of the article by using the Comments / Discussions widget at the bottom of the article. ...
18 Dec 2019 by zutt
I found the solution. My tables used MyISAM and MyISAM don't implements transaction. So now I use InnoDB
7 Jan 2021 by ahmed_sa
I can't call sp and how to pass parameter to make pivot to temp table below so can you help me execute this sp and get result stored procedure name [dbo].[rs_pivot_table] sample as below : CREATE TABLE #yt ( [Store] int, [Week]...
29 Aug 2021 by Jaa Zaib
Hi Everyone, I have a method which is storing values in database and after that it is print invoice. I'm printing a form for invoice printing. I want to make sure that if it's saving it should print. Otherwise rollback all chanages. Following is...
13 Mar 2021 by Maciej Los
This: private void AddToDatabase() { sqlCommand = new SqlCommand("Insert Into Sales(barcode_id,customer_id, pos_id,qty)values(@barcode_id,@customer_id, 1,@qty); sqlCommand.Parameters.AddWithValue("@barcode_id", temp_barcode); ...
7 Jul 2021 by durmus
I have 3 firebird databases in my project. A master database and 2 slave databases. What I need to do is to save some records in the main database to the slave databases and I have to do this at certain times. For example, every 30 minutes... I...
14 Nov 2021 by kedar001
The code shown here worked fine without any error on quality site, but the same code is causing an error The Transaction has aborted on the production site. The error occurs on dispose of the scope. Please help me resolve this issue. I did...
14 Nov 2021 by OriginalGriff
Quote: Both sites (Quality and Production) are on same Server (Server A) and database also on same server (Server B) First off, that worries me: development should never have any access to production servers, and especially not production DB...
22 Dec 2021 by Minh To Quang
So I have two microservices, one that has a database and one that make RPC calls to the one that has the database. The one that makes the RPC calls (I called it gui-microservice) has two services, BookService and LoanService. These two services...
5 Apr 2022 by Maciej Los
Start by reading MSDN documentation: OVER Clause (Transact-SQL) - SQL Server | Microsoft Docs[^] SELECT ... FROM ( SELECT P.PartsFamilyID, P.PackageID, R.RoHSStatus, COUNT(*) OVER(PARTITION BY M.LeadFinishPlatingID ORDER BY ...) AS Cnt1,...
25 Sep 2016 by Kyriakos Akriotis
How to use TransactionScope in your MongoDB operations.
28 Jun 2022 by DiponRoy
How to use MERGE statements in different databases
14 Dec 2018 by Apriorit Inc, MikeSotnichek
Examples of fixing vulnerabilities in smart contracts
1 Sep 2015 by yash00121
Below is my code for updating items in a invoice . i add some items , and update some items based on values but it is just inserting or updating the same values to all the rows . I think the paramerters are creating the problem , please guide me to rectify the fault . ...
5 Apr 2022 by ahmed_sa
I work on sql server 2017 i have issue i can't use count over partition instead of using having distinct main statment i use SELECT P.PartsFamilyID, P.PackageID, R.RoHSStatus FROM Parts.ManufacturingData M WITH(NOLOCK) INNER JOIN...
15 Nov 2023 by akhter86
I have below table and Data. i am trying to display ledger of a customer,with their debit and credit value,with running balance, query is below ,is giving me correct output except Head Column , Problem is that ,when Level_Five_ID_CA is null...
9 Jan 2024 by Member 14760154
I have a query like this var db, err = sql.Open("mssql", connString) if err != nil { log.Println("Open connection failed:", err) } err = db.Ping() if err != nil { log.Println("Cannot connect: ", err) } defer db.Close() if err != nil...
5 Apr 2015 by M. Rawan
HiI need to lock all tables in my database the moment i start transactionTry If con.State = ConnectionState.Closed Then con.Open() tran = con.BeginTransaction() cmd.Transaction = tran 'I need to lock database until tran commit or rollback cmd.CommandText = "select...
7 Jun 2015 by Mehdi Gholam
For networking code to work the 2 sides must be able to "see" each other, i.e. your client on the WAN must be able to connect to the server on the internal network.To do this you need to setup port forwarding on the external firewall to route the external IP address the client sees to the...
4 Jun 2018 by ahmed_sa
I have SQL query as following : SELECT TOP (99.9999999) PERCENT CAST(CAST(LEFT(SpecialCode, CHARINDEX('/', SpecialCode) - 1) AS NVARCHAR) AS INT) AS Expr1 ,CAST(CAST(RIGHT(SpecialCode, CHARINDEX('/', SpecialCode) - 6) AS NVARCHAR) AS INT) AS Expr2...
5 Nov 2018 by Aitzaz Ahsan
using (System.Data.Entity.DbContextTransaction dbTran = db.Database.BeginTransaction()) { try { foreach (var items in obj.ListOfItems) { ...
21 Jan 2019 by ahmed_sa
problem after add field dbo.trxtypeConfig.TrxArbName to query grouping is damage problem . this query below is grouping meaning it must show one line per item after add dbo.trxtypeConfig.TrxArbName query damage or show extra data because it represent details so that i need to add TrxArbName...
6 Nov 2019 by ahmed_sa
I work on sql server 2012 and i need to enhance or make this query have good performance this stored procedure work success but i need to know when make drop to temp table and cte plus how to write it with best practice for performance What I have tried: alter Proc...
18 Dec 2019 by zutt
Hello, I'm using your DLL to use a databaseMySQL in my C# project. Update: I am basing this on the following article Connect C# to MySQL[^] I'm trying to perform a transaction, but it's never Rollback my request. Here is an example: using (MySqlConnection db = new...
6 Dec 2020 by akhter86
I want to sum of Inv_Type = Received ,if Invoice is create on 06-03-2020 which inv_type is Payanle and their Receiving on different Date, like below condition in image ,https://ibb.co/M8zZ4J0 In Image inv_ID 211(Inv_Type=Payable),is created on...
5 Mar 2022 by ahmed_sa
i work on sql server 2019 when update data on table it take too much time so i try to see that and analysis that SELECT [Spid] = session_Id , ecid , [Database] = DB_NAME(sp.dbid) , [User] = nt_username , [Status] = er.status...