Most voted "trigger" questions
A database server is a code of procedure executed automatically in response to certain events in a given table or view in a database.
Learn more…211 questions
Sort by count of
-
1
votes1
answer128
viewsTriggers in Mysql with "Unknown column" errors in the key of a table where these triggers are stored
I don’t understand why you made such a mistake Unknown column in three triggers of the same table, as it always points to the keys and they in my view are correct. The error comes from the cd_sale…
-
1
votes0
answers91
viewsInstead of Trigger to enter values - ORACLE
Summarizing my problem, I need to automatically insert values into a table after other values are entered into it. The way I found to do this on the Oracle was by using a Trigger of the kind INSTEAD…
-
1
votes0
answers25
viewsProblem with Trigger in select/Insert
Personal I created two entities, where the information of one is manipulated by the other. That is, I own an entity conta and another conta_extrato the balance of the entity account is modified only…
-
0
votes1
answer308
viewsmysql Trigger if not update
I have a question when creating a Trigger, I need it to be executed only if the field has not been updated: integraProduct, if any other field is updated it should be executed. DELIMITER $$ CREATE…
-
0
votes3
answers1715
viewsCreate a Trigger that runs whenever a product is deleted
How to create a Trigger that is executed whenever a product is deleted, performing the delete action in all batches related to the deleted product. Here’s my SQL code: create database provafinal;…
-
0
votes1
answer473
viewsTrigger that feeds a table with information from another Mysql
I have a database in Mysql with Stock, Sales and Ite_sales tables. When making a sale record information in the Sales and Ite_sales tables, but I want to get information from the Stock table and…
-
0
votes2
answers400
viewsCreation of Trigger Sql Server
I’m creating a Rigger to create a copy of the changed data in the table. But it presents an error. USE [BANCO1] GO /****** Object: Trigger [dbo].[BANCO1] Script Date: 08/07/2015 14:13:34 ******/ SET…
-
0
votes2
answers1263
viewsShooting click event with Trigger does not work as expected
I am using the Wordpress plugin Metaslider for slides, and in it is possible to add links to the images. I created a button and I need to simulate the click, as you were clicking on the currently…
-
0
votes1
answer155
views -
0
votes1
answer1456
viewsHow to run Trigger sqlserver
How can I execute a Trigger in unit tests. I have a Trigger I have a Rigger as an example: ***-- Create one trigger with two inserts:*** create trigger trg_I_Table_1 ON Table_1 FOR INSERT as insert…
-
0
votes0
answers278
viewsHow to recompile all Views, procedures and triggers in Firebird?
I need to recompile all Views, procedures and triggers in Firebird, not by Ibexpert, but by Delphi XE2, I will pass an SQL, I would like to know how to perform such a procedure.
-
0
votes1
answer834
viewsCreation of Trigger for INSERT in another table in Ibexpert
Good morning, I had the need to create a stock control but I had never used Rigger. I have 3 tables COMPRA ABASTECIMENTO and MOVIMENTO_ESTOQUE Table MOVIMENTO_ESTOQUE : I would like when I make a…
-
0
votes1
answer4352
viewsDoubt how to use IF in a TRIGGER in mysql
Hello! My problem is the following I have two tables, a table called notes and another call students. I need to make a comparison with the id_student on the table notes and the id present in the…
-
0
votes1
answer287
viewsJPA Eclipselink - Trigger SQL SERVER
I’m having a problem with a Trigger created in SQL SERVER. When I insert the data into the table that starts Trigger directly in SQL SERVER Trigger works normal, however when performed insertion by…
-
0
votes1
answer49
viewsHow to create a Rigger After Update
I need to create a Trigger that performs an update in column A of table T, as soon as column B of that table is updated. So I think I need to create an After Update. But from what I understand, it’s…
-
0
votes0
answers766
viewsTrigger to update a field automatically after Insert
I have a user table, basically: CREATE TABLE IF NOT EXISTS `sistema`.`user` ( `id_user` INT NOT NULL AUTO_INCREMENT COMMENT '', `hashed_id` VARCHAR(40) NOT NULL COMMENT '', `nome` VARCHAR(40) NOT…
-
0
votes1
answer198
viewsIF with syntax error
I’m trying to create a simple chat system using database but want to automatically when it reaches a limit of Rows in the database it automatically run the truncate. The Trigger code I made was…
-
0
votes1
answer655
viewsHow to verify if a Trigger exists or not before creating it?
I intend to create a Trigger in table but first I would like to check if it already exists in my base .... how do I do ? CREATE TRIGGER IF NOT EXISTS before_update_tableX ... ect…
-
0
votes0
answers67
viewsTrigger mysql - error?
Hi, this is the first time I’m using triggers and I don’t know how to fix an error I’m having and a problem I don’t know how to do. I want to do a Rigger for when a date entered (start date and end…
-
0
votes1
answer1825
viewsTrigger to update another table
I have 4 table in my Mysql database. -> companies -> contacts (company addresses) -> bank data (company’s bank data) -> members (members of the company ) All tables relate to the…
-
0
votes1
answer264
viewsInsert same data into two Mysql columns
Hello! I have a table with the name tabx and two columns y and z, when I insert the values in the column y I need a Trigger to copy this value to the column z. I have tried some solutions but…
-
0
votes1
answer1444
viewsERROR 1242 (21000): Subquery Returns more than 1 Row
I have a problem with a Trigger (Mysql). I tried to build it myself. The need: I have a system of occurrences where when moving to the closing stage (Stage 4) it check if a description has been…
-
0
votes2
answers1381
viewsHow to create a Rigger to save updates from two tables?
I have two tables : Tabela1 : three-column id_product, product name, product price; table 2 : four-column id_brand, id_product, tag, price_tag; I created a new Tabela3 : three-column id_product,…
-
0
votes1
answer1652
viewsHow to create a Trigger for a specific column of a table?
I created a Trigger to my table X, with the purpose of making a record of update that run you in this table. For each update on the table X, modified (old) values are stored in the table Z.…
-
0
votes0
answers22
viewsTriger after update as a solution to debit credits safely
I need to make an interface that guarantees the integrity of the customer’s credit. In PHP, when we use LOCK explicitly in PDO, with LOCK TABLES, when dealing there may be inconsistency, when the…
-
0
votes1
answer707
viewsif () syntax in a Trigger
I’m having difficulties with the if() syntax in phpmyadmin. I have to create a TRIGGER to insert information in a log when the name of an animal table animals is changed. But there is a syntax error…
-
0
votes1
answer66
viewsIF Mariadb phpmyadmin
I’m trying to create a Rigger using phpmyadmin with Mariadb bank but when it gets on the line if it gives a message: unrecognized statement type. (near IF) Trigger is the one: SET @TOTAL = (SELECT…
-
0
votes2
answers99
viewsTrigger for table optimization
I’m trying to create a trigger which rotates the control OPTIMIZE mysql. In short, I have an A table and created a B table that will save a datetime where this value will be updated every time the…
-
0
votes0
answers41
viewsCreate Registration Trigger
Trigger that by deleting a record from any of the dimension tables generated by the model you created, delete all records linked in CUBO_EMPESTIMO. SQL Database. Attached image of the model…
-
0
votes1
answer402
viewscreate Trigger mysql
I have two tables: the requested table and the logs table. Users can interact with the requested table, link a php script that runs a query update and update the status column. I need to create a…
-
0
votes2
answers1581
viewsFunction with Insert according to a select that returns a list of ID’s - Postgresql
I need to make a Rigger after insert calling a function that takes the last record inserted into a certain table and inserts the ID of that last record into another table according to a select that…
-
0
votes2
answers391
viewsError "1241 - Operand should contain 1 column" in Trigger that checks duplicities
I’m doing this Rigger to check if it already exists dados_id and referente_obs in the bank table But returns this error: 1241 - Operand should contain 1 column(s); BEGIN IF (NEW.id_dados and…
-
0
votes1
answer605
viewsPostgresql regular expressions
Come on, guys, I need some help I’m trying to make a Rigger in postgresql that checks whether the format of a new data to be inserted into a table is in a certain format, in this case the phone…
-
0
votes1
answer234
viewsError running SQL "Create Trigger..." inside a C#application
Goal: Run a create Trigger script using a string within C#. Problem1: Table not found (because the script does not indicate in which Table to create Trigger). Tentative2: Start string with "Create…
-
0
votes0
answers52
viewsCreate Trigger in oracle
I have three tables: Usuario, Lembrete and Lembrete_Usuario on the Oracle. I am trying to create a Rigger that when I insert in the User table and Reminder, take the ids, User and Reminder, and put…
-
0
votes1
answer341
viewsCatch table name with Trigger/Function in Postgres
I am implementing a simple replication form of two tables or more. I have the table replication which has the table name to be replicated and id. To feed the table replication I have a Rigger in…
-
0
votes0
answers68
viewsVery slow recording after adding Trigger in MYSQL Insertion
When I insert this Rigger into my database it is taking a slow time, getting to give this message: Errormessage: Lock Wait timeout exceeded; Try restarting transaction My Trigger is as below, the…
-
0
votes1
answer833
viewsHelp with Trigger summing/subtracting
I need help creating a Trigger in SQL Server that takes a value INTEIRO, and two STRING(FK), inserted in a tabela X, and check if the second value is 1 or 2, if it’s 1 she must add up this value…
-
0
votes1
answer25
viewsConcatenate an SQL value
I have a Rigger that updates a certain table of raw material, however it replaces the existing quantity and I need it to concatenate the new value with the existing value, someone could help me how…
-
0
votes1
answer134
views -
0
votes0
answers55
viewsHow to create triggers in BD using XAMPP?
A group has N events and each event has M spending. 1) The following Trigger should update the last modification made in the group when an INSERT is made in the event table. Why it does not work?…
-
0
votes1
answer505
viewsSQL Server - Trigger does not run after a given field
I’ve got Trigger down: CREATE TRIGGER AtualizaDataAlteracaoSegmentos ON dbo.Segmentos AFTER INSERT,UPDATE AS BEGIN Begin tran update Segmentos set DataAlteracao = GETDATE() where Id = (select ID…
-
0
votes1
answer1140
viewsTrigger to upgrade stock
I’m trying to create a trigger to update my stock of products, when the status of my purchase is closed (CF = Closed Purchase). However, it is sending me an error, and I could not identify what is…
-
0
votes1
answer41
viewsWPF - Trigger elements within a wrap panel
I have a wrap panel that contains several dockpanels, and I need each dockpanel to change its background by hovering over it. I don’t think creating a Rigger for every element would be appropriate.…
-
0
votes1
answer573
views"gen_id()" or "select max()" for Auto Increment in a PK field?
Currently I use a Trigger with this SQL code to get an Auto Increment to be assigned in the primary key field (PK) of the tables: create or alter trigger TRI_CLIENTES_BI for CLIENTES active before…
-
0
votes2
answers392
viewsError in Trigger - Mysql
I created the following Rigger, but it has a syntax error that I can’t find. The error is as follows ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that Corresponds to…
-
0
votes0
answers76
viewsTrigger no sql server management studio
I would like to create a Trigger in MSSMS (Sql Server) that, if I made an INSERT in table A, with the last record of table B, it would insert 10 more records in table B, and so on whenever I used…
-
0
votes1
answer51
viewsGet sql that triggers a Trigger before update
I have a Trigger before update very simple, I would like to take the sql that fires that Trigger. CREATE OR REPLACE TRIGGER atualiza_subelemento BEFORE UPDATE ON tb_material FOR EACH ROW BEGIN IF…
-
0
votes1
answer21
viewsTrigger executes if a column value is 'Database I'
Create a trigger that automatically enrolls a student in "BD Laboratory I" as soon as it is registered in "Database I". use Universidade; insert into Realiza_matricula (RGAacad, Nomedisc)…
-
0
votes1
answer50
viewsTriggers - I need help solving the issue below
I have the following situation : The tables described above are ger_usuario, ger_mensagem and ger_destinos. Being, the field proprietario (ger_mensagem) a FOREIGN KEY referencing the table…