All Questions
Tagged with trigger transaction
29 questions
31
votes
1
answer
36k
views
Trigger in combination with transaction
Suppose we have the following situation:
We have a table (let's say Table_A), wich has a trigger on INSERT. The trigger job is to update some rows in table_B based on the inserted values in table_A.
...
11
votes
2
answers
24k
views
Can we commit the transaction when the sql server trigger fails?
I am trying to avoid data loss when the insert trigger on a table fails. I am trying this with the following scenario and my code is failing.
When an insert happens on the Customers table, I want to ...
11
votes
1
answer
6k
views
Synchronization using triggers
I have a requirement similar to previous discussions at:
Writing a simple bank schema: How should I keep my balances in sync with their transaction history?
Trigger in combination with transaction
I ...
9
votes
3
answers
8k
views
Using MySQL triggers or transactions?
I want to ask your opinion in using MySQL triggers or transactions in a website.
Actually I have a history payment table with - UserId | OperationId | Comment | Credits | Sign (debit or credit). So ...
5
votes
3
answers
17k
views
Does a trigger in a transaction only fire when the transaction is committed?
I'm a developer, but I turn to the dba community for the following question.
I'm writing an integration test in C#. In this test, I start a transaction first, and always rollback so nothing is ...
5
votes
3
answers
1k
views
Deadlock Error from SQL Server 2000 to SQL Server 2008
After migrating data from SQL Server 2000 to SQL Server 2008, when I am doing any a transaction in the table which find out more row on the database, that's gives me error.
Transaction (Process ...
5
votes
1
answer
503
views
Triggers and the Transaction
We recently made a change to create constraints based on logic previously used in stored procedures, and part of that included the use of INSTEAD OF triggers to centralize logic.
The logic is ...
4
votes
1
answer
4k
views
Trigger/Event that fires when a Transaction finishes
I have a query that pulls from about 15 different tables. I am looking to materialize this into a table that stores it in xml/json. (To improve performance.)
The problem I have is that these tables ...
3
votes
1
answer
725
views
Use of Trigger After a Transaction
I have a scenario where there is a transaction being executed to update a few tables. On one of these tables there is a trigger that accesses the data on those tables, but is only planned to be on ...
2
votes
1
answer
4k
views
Difference between a trigger and a transaction [closed]
I'm implementing movie rating service, so I'm considering about using triggers or transactions.
What I'm considering is inserting movie information into a movie_list and to insert the genre of that ...
2
votes
1
answer
2k
views
Does encapsulating a statement in a transaction include the triggers it fires? [duplicate]
I have an INSERT that will fire a TRIGGER which will UPDATE an attribute on another TABLE. I need to make sure that if the INSERT is successful and the UPDATE inside the TRIGGER isn't then the whole ...
2
votes
1
answer
5k
views
Handling duplicate values using trigger
I have a database where tables are like:
tblCustomer(UserID [Primary Key],Facebook,Twitter,PhoneNum);
tblSales(InvoiceID [Primary Key],CustomerID [Foreign Key],ProductID [Foreign Key]);
I'm ...
2
votes
1
answer
556
views
SQL Server Logon Trigger causing problems with the Distributed Transaction Coordinator
I've created the following simple logon trigger on my SQL Server 2005:
CREATE TRIGGER LOGON_RESTRICTION ON ALL SERVER
FOR LOGON
AS
BEGIN
PRINT 'Hello World'
END
GO
Which seems to be working fine ...
2
votes
1
answer
5k
views
ROLLBACK make data in INSERTED table is removed in AFTER INSERT TRIGGER
I give an example to show my problem. I create a table as the following:
CREATE TABLE a
(
id INT
)
I create a AFTER INSERT trigger to don't allow to insert id=1 into table "a"
CREATE TRIGGER [dbo]...
2
votes
0
answers
2k
views
Postgresql trigger - get all changed rows after transaction
I have invoice_item table and invoice table. I need to check total price of Order after each transaction. Since I still want to be able to change things, I need trigger after each transaction.
CREATE ...
1
vote
1
answer
164
views
Does trigger "see" all changes done in the transaction it was fired from?
Let me elaborate on the title.
Suppose we have two tables, t1 and t2. t2 has a trigger t2_trgon it. Same transaction inserts/updates data in t1, then does insert/update in t2. t2_trg is fired and ...
1
vote
1
answer
13k
views
Uncommitable T-SQL transaction after trigger applied to table
Good morning,
I have written a Trigger on a table that should evaluate the entered values (Length, width and Height) and based on those entered values, should update a column (Type) in the same record ...
1
vote
1
answer
2k
views
postgres+JDBC: fire trigger with non autocommit transaction
i have a jdbc client that make an two INSERT query on database whitout autocommit, and a trigger on database that fires when a insertion is done on a certain table
public foo() throws MyException {
...
1
vote
1
answer
1k
views
PostgreSQL 9.3: Primary key violated by a trigger INSERT
My problem
Consider a table t with many frequent updates from users, from which only the last few are relevant.
In order to keep the table size reasonable, whenever a new row is inserted old rows ...
1
vote
0
answers
2k
views
delete or rollback an insert if a trigger on insert fails
is it possible to delete or roll back insert statement if a trigger on that insert statement fails due to some reason.
for eg i have a trigger on insert into employe(id,name) values(1,'ali')
trigger
...
1
vote
2
answers
3k
views
Can I emulate Oracle's autonomous transaction in MySQL?
I have a number of tables that have triggers on them that insert records in queueing and logging tables. The problem is that those inserts are then part of the same transaction. That means that any ...
1
vote
0
answers
294
views
Make the SQL Database manage CRUD operations
Is it possible to have a client app send a transaction of INSERTs to a table. Then have the table triggered somehow to run through the inserts and either INSERT the row or UPDATE an existing row?
If ...
0
votes
2
answers
245
views
Variable Value Set in TRY CATCH is Discarded When Trigger is Coded a Certain Way
I know this goes against all things logical, however, I am attempting to push this through anyway :(
There is a scenario in which records are written to a table with the trigger below attached. ...
0
votes
1
answer
81
views
Use a value for a Postgresql setting in a trigger
We're using a trigger to track changes in various database tables. This works fine. Now we want to be able to track the changes back to the web request that caused them.
I'd like to be able to use ...
0
votes
1
answer
615
views
How to ensure a trigger is fired after variable number of inserts?
I have a 1:N relationship between two tables - let's call them "foo" (the parent table) and "bar". I have some triggers on both "foo" and "bar" tables. I insert data in a single transaction, first to "...
0
votes
0
answers
43
views
Trigger with EXEC and Only Debug Statements After First Exception Saved [duplicate]
I apologize for the verbosity of this post.
To catch DDL changes after a snapshot or full load (using aws/dms here) has been performed, there is sourceDB.tblAWSObjects which replicates to targetDB....
0
votes
1
answer
82
views
Duplicate record inserted - why trigger is not preventing it?
I have two tables: DebitIUVs and RPTs. I have record inside DebitIUVs which is with state 118001. My business logic must insert new line inside RPTs table. Inside RPTs table there is additional ...
0
votes
2
answers
199
views
Elements inside a container: How to perform atomic operations on them?
In my DB (Postgres 9.4) I have the following items: Tshirts, Jeans, Shoes and Boxes.
Tshirts, Jeans, Shoes can be placed inside a box and they can have a color (the color may be null).
Each element ...
0
votes
1
answer
624
views
Is it possible to make a trigger that does not allow INSERT?
I'm currently learning how to implement sqlite commands through C code and I've been trying to figure out the best way to ensure that no data can be inserted to a table (which will only happen during ...