Procedural code automatically executed in response to a database event.

learn more… | top users | synonyms (1)

0
votes
0answers
19 views

Oracle SQL Updating Trigger Statement

Hey all so let me see if I can clearly explain what I would like this trigger to exactly do. First of all the trigger will deal with 2 tables: Delivery Table: DeliveryNum |ItemName | Quantity | ...
1
vote
1answer
18 views

Trigger to apply user mapping to logins on database creation [on hold]

Does anyone have any example triggers that apply user mapping on database creation?
0
votes
1answer
11 views

MySQL Replication, Can i add a trigger to the SLAVE db?

Is it possible to do so? The trigger will insert some rows into a unique table that exists only on the slave.
0
votes
0answers
18 views

Efficient Trigger updating in Postgresql

So I have a big table that often needs specific columns updated for a large number of rows. So right now I have it set up so that there is a 'staging' table that has the update-able columns. Then upon ...
1
vote
3answers
178 views

How to create a SQL trigger to execute a stored procedure when a table is updated

i need some help with creating a trigger to run a qf.stored_procedure when a qf.table is created. AT the moment, i have a job t run the stored procedure every 15 minutes but changing that is not an ...
0
votes
0answers
24 views

Delete data from related Tables with condition

I have Table a (id, id_d); --fk contraints = on delete cascade Table b (id, language_code); Table c (id_a, id_b); --fk contraints = on delete cascade Table d (id); I want to delete an entry from ...
0
votes
1answer
17 views

MySQL Local Variable Scope and Triggers

I have a couple triggers that automatically update invoice data and set some statuses in the database. However, it appears that if 2 Triggers have variables that are named the same, they get ...
0
votes
0answers
21 views

Better way to create an Events table?

I working on a medium sized PostgreSQL database with some schemas, each with some tables. In almost every schema there are tables that represent event tables, where something that has "happened to" ...
1
vote
1answer
33 views

MYSQL-BEFORE UPDATE Set value of Column A to value in Column B if Column A is to be updated

I have a nightly scheduled event which updates all rows in 'products' table with the newest 'unit_price' from a price list table where 'price_list.active-date' is >= the CURDATE(). What I need to do ...
0
votes
1answer
36 views

Unable to update or insert values table with DateTime column defaulted to GETDATE

I have atlered table by adding Datetime column. This column is not null and also default value from GETDATE(). ALTER TABLE myTable ADD myDateColun DATETIME NOT NULL DEFAULT (GETDATE()) I'm trying ...
1
vote
2answers
37 views

Need to convert date to word using trigger

I have created a datetoword function in Mysql. Checked the function working fine. Now using this function need to convert the date from field1 (date-datetype) to field2 (Varchar-datatype) within the ...
1
vote
1answer
51 views

Can Execute trigger in SQL Server 2008 R2

I'm trying to create a simple trigger to update a table's column after it was inserted. But when I execute the trigger it produces an error: Cannot execute script. Additional information: Unable ...
0
votes
1answer
28 views

how to use trigger to make SQL Job's step success or fail

Step 1. Call a script to trigger application process. When the application process start, it will insert a record to a specific table. And once the process ends, that record will be deleted from ...
0
votes
1answer
51 views

trigger - Sql2008 - Msg 7391 - “no transaction is active/unable to begin trans”

I have a trigger on my SqlServer, located in server7. It inserts a data on another server ( server5 ), after insert, as you see the code below: CREATETRIGGER [dbo].[trgSPTInsereDepartamento] ON ...
0
votes
1answer
27 views

Can I fail the current transaction from within a trigger?

Table DDL: CREATE TABLE trigtest(a INTEGER IDENTITY(1,1) PRIMARY KEY, b INT) I currently have CREATE TRIGGER MaxDelete ON trigtest INSTEAD OF DELETE AS IF @@rowcount < 1000 DELETE trigtest ...
0
votes
0answers
13 views

getting an error in trigger while invoking a procedure in it

i have created a procedure name 'prd' which contains 3 parameters (pmat_amt,pstartdate,pstopdate) which is used to update a column in the table rd_details contains 3 columns which are ...
1
vote
1answer
41 views

Trigger AFTER INSERT on tables with different columns

I'm writing a trigger that works after an insert. This is what I have: create trigger trgInsereQuestao on tblquestaoOpcao after insert as begin set nocount on; insert into ...
1
vote
1answer
78 views

UPDATE/INSERT into Dynamic Columns

I am trying to update columns based on the value of the inserted column of the table 'my_table'. I want to be able to record the timestamp of the values changed. I am using the triggers but I can't ...
0
votes
0answers
22 views

MySQL : How to know if Trigger was fired

Someone can help me please , I want to log error about triggers in MySQL 5.5 I'll like to know if it's possible to know if a trigger was'nt fired ?
0
votes
0answers
25 views

Did this trigger break replication?

I added a trigger to a replicated database. DELIMITER $$ USE `database`$$ DROP TRIGGER /*!50032 IF EXISTS */ `some_ins_after`$$ CREATE /*!50017 DEFINER = 'user'@'%' */ TRIGGER ...
1
vote
0answers
21 views

How to set the trigger when field(contain json value) is updated?

I have one table in which there is one field called info.This field hold json value. I want to create trigger on this field.I want to split this json format string into record I mean I want to insert ...
0
votes
1answer
50 views

Deadlock caused by INSERT trigger - thread looking for lock it already has?

Using MySQL 5.6.17. I have a table with an INSERT trigger that reads values from that table and 4 other tables, combines the results and writes that to a sixth table. Ever since I added this trigger, ...
0
votes
0answers
40 views

mysql trigger, let trigger recalculate throug whole table after correction of errors

Raised this question before but no answer found I have one table (table1) with energy data updated every 5 min I am using a trigger to calculate day values on every update and fill another table ...
0
votes
2answers
72 views

Error in trigger: table X is mutating, trigger/function may not see it

Having looked at the following Trigger, still getting the Row 2 error: "ORA-04091: table SUMMITTEST.APL_LOG is mutating, trigger/function may not see it" Please can anyone provide any help in ...
0
votes
0answers
25 views

how to update 'update trigger fired record's column?

I'm new on this task. I tried to update when I/F table insert after trigger. but it wasn't work.. There is my trigger source like.. create trigger T_ATABLE_I after insert on ATABLE for each row ...
1
vote
0answers
15 views

Error when creating Trigger (PostgreSQL 9.4)

I created a table 'Company', and I want to create a trigger so a company can only present in one city, but it can be present in several different cities in the same country. For example, there's only ...
1
vote
0answers
67 views

Oracle instead of trigger update performance issue

I have a large table containing over 15million records with 4 columns that form a compound key. Because we use a development environment that doesn't support compound keys I was required to create a ...
1
vote
0answers
41 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
1answer
39 views

Alter trigger Oracle

Does alter trigger hang if a table is locked by some DML operation ? What kind of exception does it throw? Resource busy 0054 or some other exception...? I have tried to reproduce this scenario but ...
0
votes
1answer
40 views

Using dynamic database name for DML in trigger

I am using SQL Server 2008 in my application. Here I need to do database operations between multiple databases. The complexity is database names are user defined except one masster database. I can ...
2
votes
1answer
107 views

Subquery returned more than 1 value. This is not permitted + Trigger Error SQL Server

This trigger will update Is_Confidential_or_VIP column to 1 or 0 based on the text inserted or updated into ConfidentialRegistrationFlag and VIPType columns : create trigger ...
0
votes
2answers
46 views

Error in setting a value in sql server trigger [closed]

I'm trying to make a trigger that checks which staff member have the least amount of assigned tasks, before adding the task, and assign it to that member. What I came up with was something like this: ...
1
vote
1answer
57 views

Insert rows in a table, via a row-level trigger, activated after insertion in that same table

I have to design a schema and trigger system in SQL that will save words and their synonyms. I thought of this basic schema: create table words ( id int primary key auto_increment, word ...
1
vote
1answer
28 views

Trigger that records values for 5 columns from 3 tables when a value for column Z in table 3 is of a certain value

I am new to triggers and SQL in general. Sorry in advance if this forum is only for experts and this is a newbie question... I need to create a trigger that fires when someone tries to submit a ...
1
vote
0answers
56 views

How to Avoid Mutating Error in Oracle

I am using Oracle 11g. I have a this trigger: create or replace TRIGGER TRG_UPD_RAPRJCT11 AFTER UPDATE OF CURRENT_STATUS ON AGL_RAPROJECT FOR EACH ROW BEGIN IF (:OLD.CURRENT_STATUS='Review2' and ...
2
votes
1answer
105 views

Why can't trigger be dropped from database?

One of the databases I manage is provided by my company's vendor which we restore in order to pull data out for our data warehouse. I'm writing a stored procedure to go through the database users and ...
0
votes
1answer
49 views

MySQL error #1064 while creating a trigger [closed]

DELIMITER $$ DROP TRIGGER IF EXISTS brandRep $$ CREATE TRIGGER brandRep AFTER UPDATE ON sales_flat_order FOR EACH ROW BEGIN IF (NEW.status <> OLD.status AND OLD.applied_rule_ids <=> ...
0
votes
2answers
104 views

insert inserted id to another table

Here's the scenario: create table a ( id serial primary key, val text ); create table b ( id serial primary key, a_id integer references a(id) ); create rule a_inserted as on insert to a do ...
0
votes
1answer
18 views

Update Trigger in MYSQL

Here is my requirement :- I have a table called "users" and field called "Admin". Field "id" is primary key. Wants to update "Admin" field to "1" if id=1000; Tried this ,but not working.I tried ...
1
vote
1answer
82 views

How to retreive deleted records in a trigger on a table with composite primary key

I am trying to optimize a trigger on a table in a database from a 3rd party. I am not allowed to change or add any columns to the schema. The table has a composite primary key, one column is an ...
0
votes
1answer
121 views

Trigger syntax on phpmyadmin

I can't make this work. I want to create a trigger that deletes the child foreign keys before I delete the parent primary key. This is the code that I am using on phpmyadmin: delimiter // CREATE ...
1
vote
1answer
45 views

XACT_ABORT OFF vs COMMIT in trigger

I have a trigger on a table that kicks off several other processes. However, I would like to ensure that even if the other processes fail, the insert is successfully committed to the original table. ...
-1
votes
1answer
52 views

what is the syntax for insert trigger?

I am very new to sql. feel a little stupid to ask this question Say I have this table Warehouse(shipperid, name , state). Then I define another table warehouse_maine (shipperid, name, state) which ...
0
votes
1answer
53 views

SQL Server 2012 Replication, how to ignore action with specific trigger?

SQL Server 2012. Database is in merge replication, no conflicts presented. Current example is simply for understanding, but real schema is very huge to describe. Schema and trigger at SQLFiddle for ...
0
votes
1answer
76 views

PostgreSQL - retrieving max primary key column to insert a new row - any alternatives?

We are using a software that needs to request the max primary key column value to add a new row into the table that was requested. I know that there are some alternatives like: Sequences, and GUIDs ...
1
vote
0answers
44 views

Prevent row from being inserted with a trigger

I'm trying to prevent a row being inserted if a certain condition is met using a trigger. I'm using a user defined exception to do this, however the row is still being inserted, despite the exception ...
1
vote
1answer
35 views

MySQL: Adding an IF condition to trigger?

We've got a trigger that is overwriting the uuid value before insert. The vers.1 of our API depended on the DB to generate the UUID's, but I'm writing v2 which is using a library that generates the ...
0
votes
1answer
55 views

why is my trigger called even when the underlying table didn't change?

I have a quite basic trigger defined as such: CREATE TRIGGER dbo.foo ON dbo.bar FOR INSERT, UPDATE, DELETE AS ... I also have a stored procedure which at some point does something like this: ...
1
vote
1answer
53 views

MySQL created_by or updated_last-by [closed]

I've been giving the task of taking SQL DDL from data modeler and to transcribe it into mySQL for an internship. The only thing I cannot figure out is how to take Created_By VARCHAR2(30) DEFAULT ...
2
votes
4answers
191 views

Getting new and updated data with an archive column

I am trying to optimize an SSIS package that retrieves data from a very large transaction table that gets millions of new records daily. The data is being collected from several hundred field servers ...