Questions tagged as 'trigger'

1
answer

MYSQL How do I make a trigger to update stock after canceling an invoice?

I want that after canceling a record in the tblingreso table the corresponding stock in the articles table is updated (the stock is subtracted): UPDATE tblingreso SET estado='Anulado' WHERE idingreso='1'; I have my table tblingreso with...
asked by 11.12.2017 / 07:31
1
answer

Triggers in MySQL?

Greetings, I have a table called audit that contains the fields: - codigo_auditoria INT - fechahora_auditoria DATETIME - tabla_auditoria VARCHAR - operacion_auditoria VARCHAR - usuario_auditado VARCHAR - campo_actualizado VARCHAR...
asked by 25.03.2017 / 22:44
1
answer

MYSQL blocks the SELECT when executing an UPDATE in a trigger

This is the error I receive    SQLSTATE [HY000]: General error: 1442 Can not update table 'accounts_cobrate' in stored function / trigger because it is used by statement which invoked this stored function / trigger. If I use a static id i...
asked by 22.03.2017 / 15:19
1
answer

Insert data from a table into another SQL

I have a MySQL database for a car dealership. There are 3 types of users: A, C and P. What I am trying to do is that when a new data is inserted in the table users with type "P", it is also inserted in the suppliers table. That is, when I add...
asked by 26.04.2018 / 15:41
1
answer

Trigger "Triggers" Insert OR Update Mysql

My question concerns the creation of triggers in Mysql Currently create the following trigger: CREATE TRIGGER movimientotEquipo AFTER INSERT ON movimiento FOR EACH ROW IF EXISTS (SELECT * FROM equipo WHERE equipo.ide_af = NEW.af_id...
asked by 20.04.2017 / 21:53
1
answer

Trigger in SQL server

I wanted to do a query of triggers in SQL Server. I do not know if it will be complex but I am needing to solve the following: The LINKED CASES column I need to be a field calculated through the execution of a trigger, every time a record is...
asked by 16.06.2016 / 13:53
1
answer

Error in 'semicolon' sintaxys and expected input end

I would like help to solve this trigger that throws me errors in the VALUES line says    "syntax error: missing 'semicolon' ' And in the last line in the END appears    "syntax error: extraneus input found - expected end of input ......
asked by 20.02.2017 / 05:41
4
answers

Trigger with MySQL query

What I need to do is the following, when a record is entered into the orders table, a trigger is made to perform the following query: SELECT timestampdiff(MINUTE, fechaDeSolicitud, now()) <= 120 FROM pedidos WHERE idPedido= (aqui iria el...
asked by 23.05.2016 / 04:44
0
answers

triggers or mysql stored procedure [closed]

I am carrying out a project of industrial warehouses and warehouses but I have a doubt when making the registration of contracts. When I register a contract, I occupy a warehouse that is identified by its id. The problem comes when I register 2...
asked by 28.11.2018 / 06:09
0
answers

Trigger SQL Server insert / update valid table field if it is in another table

my question is this: I have 3 tables Tabla_ArticulosLote Product Warehouse Lot Physical Tabla_MaestroArticulo Product Table_BagsArticle Product Warehouse Quantity What I'm looking for is that when making an insert / update in Table_A...
asked by 25.09.2018 / 00:06