Procedural code automatically executed in response to a database event.

learn more… | top users | synonyms (1)

1
vote
1answer
21 views

List with all visible meta data in AFTER UPDATE trigger

I have the following issue - something is updating particular table columns when such update is not allowed. I was not able to find the object (searching in T-SQL and ASP code, server jobs), so I ...
0
votes
1answer
13 views

How to limit schema size by a trigger

The problem: I am running on a Webhotel a MySql database with different schemas with a maximum size limit on each schema. I can't change any settings on the DBMS. To be able to keep the schema below ...
1
vote
1answer
20 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 ...
0
votes
1answer
32 views

Log all table updates for all tables in MySQL

Is there anyway I can get the last updated time of a set of tables? By last updated time, I mean not only when the table's schema changed but when any of the rows changed or even when rows were ...
0
votes
0answers
34 views

How to ensure a field is populated before use in a trigger

When I assign a new bed number in a hospital, the number must be prefixed by the ward number the bed is in. How do I know my user is going to populate Ward_Id before Bed_Id? What does one do in a case ...
0
votes
1answer
24 views

Is it possible to modify an existing trigger definition in MySQL?

I am wondering if it is possible to update a trigger definition in MySQL. For example, I have a trigger T and I want to add some new functionality to it. My assumption is that I need to drop and ...
0
votes
2answers
32 views

Postgres: error message “does not exist” when dropping existing trigger

I have a trigger associated to a table. When i drop it via DROP TRIGGER IF EXISTS myTrigger on dummytable; postgres tells me NOTICE: trigger "mytrigger" for table "dummytable" does not ...
1
vote
0answers
25 views

How To Log Select Statements from 1 User On 1 Table Into a Permanent Log Table

We have a centralized authentication library that 100+ applications use to authenticate users. That library has its own DB credentials. It would be extremely useful to log every time that library/user ...
1
vote
1answer
37 views

Updating mysql trigger via information_schema — access denied?

I have some wrong "definer"s for some triggers in MySQL (actually MariaDB). I figured the easiest way of correcting them would be some version of: use information_schema; update triggers set ...
0
votes
0answers
25 views

Service Broker received an error message on this conversation

I will first have to say, I am still trying to wrap my brain around all the components of the Service Broker and how they work together, so it's very likely I'm missing something obvious... it's just ...
4
votes
1answer
95 views

How to determine if insert or update

Whenever INSERT is happened in the CUSTOMER table,I need to call the "StoredProcedure1"and UPDATE is happend in the CUSTOMER table,I need to call the "StoredProcedure2" in the Trigger. How to ...
0
votes
3answers
52 views

Instead of Trigger Continue with operation after custom logic?

I do not think what I am trying to do is possible, but I could not find any documentation on this. I have an INSTEAD OF UPDATE, INSERT, DELETE that always inserts data into a history table before ...
2
votes
1answer
39 views

How would I implement interprocess communication from Oracle (10g R1) trigger using DBMS_ALERT?

Let me state up front that I'm not proficient in Oracle at all, MS SQL yes but not Oracle; which is why I'm asking this. Current Setup Oracle 10g Release 1 running on Red Hat Ent. 3 (no support) ...
2
votes
1answer
49 views

How to resolve logon trigger and EXCEPTION_ACCESS_VIOLATION?

My production sql server is running... Microsoft SQL Server 2005 - 9.00.4035.00 (X64) Sep 18 2014 16:17:31 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition (64-bit) on Windows ...
0
votes
1answer
19 views

Is it possible to run a trigger on Table Creation in MySQL

Simple Question. Is it possible to create a Trigger that runs everytime a Table is created. The goal is to create a metadata table for each table, but I can worry about dynamically passing the table ...
-1
votes
0answers
40 views

trigger that will not allow insert if age is less than 18

I am trying to create a trigger that will check if the age is less than 18 or does not exist and will not allow insert. This is my trigger but i keep getting errors! Can some one help ! CREATE OR ...
2
votes
1answer
32 views

Delay Trigger Execution

Let me explain the scenario first before asking the question. I have a database with a set of tables. One table, say Table A, contains username details, and other table, say Table B, contains user ...
0
votes
1answer
31 views

Oracle Text CTXCAT Domain Index, Transactional, and Before Insert/Update Trigger

TLDR: The CTXCAT index is supposed to be transactional, but Before Insert triggers that modify the indexed column don't seem to induce an update. I'm running on Oracle 9i. (Actually, I'm running on ...
0
votes
1answer
31 views

Choosing a RULE instead of a TRIGGER

I my current database schema, there are hundreds of tables that reference another single table (called transaction_entry), that stores generic information about each row (when it was created, last ...
2
votes
1answer
24 views

trigger can't access column loop

SSCCE: The following script: $ cat test.sql CREATE TABLE public.foo ( loop INTEGER ); CREATE OR REPLACE FUNCTION public.foo_fun(loop INTEGER) RETURNS BOOLEAN AS $$ SELECT TRUE; $$ LANGUAGE SQL; ...
0
votes
0answers
22 views

On deleting a record from a table, Save that data in another table.

I need help on trigger.i am deleting a record, i need to use a trigger which will save that record in other table. can anyone give me a general code which will help me?
1
vote
1answer
41 views

Can a PostgreSQL Trigger be used to ignore an insert?

I've got a situation where there are dozens of various triggers in our database that trigger a record being inserted into another (single) table within the database. I was hoping that while testing ...
0
votes
2answers
66 views

Send email when some users connect to SQL Server

I am looking for a way to create a logon trigger in SQL Server. Basically i need to do is when it matches some users or profiles on logon it send an alert e-mail. I have found some things for Oracle ...
0
votes
1answer
42 views

alternative to trigger. Cascade

I have 2 tables: table_a: id int, user_id int, job_id int and table_b: id int, user_id int, job_id int I would like achieve something like when I delete a row from table_a it also delete a row ...
1
vote
1answer
21 views

Handling exceptions from inside a function

I need to add a trigger after insert or update on a table so that, where some row is updated and a certain condition is met, then some other table needs to be updated. However, that last update ...
1
vote
0answers
40 views

Debugging Postgres 9.3 Triggers

Right now I have a trigger in my database that is giving me some issues. I've set up this line so I can check what is being fetched from a query RAISE NOTICE 'hstore_key = %',hstore_key; as well I ...
0
votes
1answer
36 views

MySql Condition not working in trigger

I am developing a social networking website, where I have 3 tables - 1st for users(userid- pk,auto increment,username,etc.), 2nd for Album(albumid - auto increment,userid - of person who owns the ...
3
votes
0answers
57 views

Ways to process XML into a relational structure in Postgres

I have a database that is comprised of ~10 tables, most of which have many-to-many relationships with each other (and an associated join table). I am inserting of the order 100k XML files into a raw ...
0
votes
2answers
44 views

Triggers not reflecting on procedure

I have a trigger create trigger flightinput2 on reservation after insert as begin update reservation set Departure_Airport='LDN', Arrival_Airport='KUL' where Flight_Code='EM0088' end ...
1
vote
0answers
79 views

Implementing a functionality for processing heavy insertion

I use PostgreSQL 9.1. The scenario is: I receive heavy insertion into Table1 (about 100 rows per sec). For each new row, I have to check the previous and next row of the source table if those are ...
0
votes
1answer
99 views

What is the best approach to process huge amount of data insertion efficiently

I'm dealing with a HUGE amount of data entry. I need to know the best practice to insert/update table records after new entry inserted in another table. By huge i mean we get more than 2 million ...
0
votes
0answers
31 views

Replication overview

My boss wants me to elaborate a comprehensive report about synchronisation/replication. I know that replication can be done with the DBMS (we are using SQL Server 2012), but he wants something manual ...
1
vote
1answer
34 views

Java Spring application Database triggers auditing - how to provide the right user that made the change

We are developing a new web application. one of the most basic requirement is to audit all entities changes into a separate table. We would like to use DB triggers for that purpose. We use MySQL as ...
0
votes
1answer
51 views

How to create a Postgres trigger to ensure field is non-updateable

I'm trying to create a Postgres trigger to ensure after a column's value has been set, it cannot be updated (basically make it readonly). So far I've come up with the following draft trigger. 1) ...
0
votes
0answers
16 views

DB2 Trigger for EVENT and ARCHIVE TABLE

I have a requirement on DB2. There is a two Table EVENT and ARCHIVE. Both table has ROW_ID and STATUS field. Case 1: When Update STATUS Zero to One at EVENT table that row will insert at ARCHIVE ...
1
vote
1answer
50 views

Generic Trigger on MYSQL to replicate data on other table

I'm currently doing a history table that basically logs every single modification in a history table, and adding the Action executed. CREATE TABLE `competencies` ( `id` int(11) NOT NULL ...
0
votes
1answer
53 views

MySQL add few column exception for TRIGGER UPDATE FOR EACH ROW

How to effectively add column id, name exception for trigger: CREATE TRIGGER updated BEFORE UPDATE ON table1 FOR EACH ROW SET NEW.date=NOW() so that date=NOW() will be affected on updating any ...
1
vote
1answer
43 views

MySQL After Update Trigger apparently not running

I have the following After Update trigger on a MySQL table: CREATE DEFINER = 'root'@'localhost' TRIGGER phpbb_rathermenacing.phpbb_bbdkp_memberlist_AUPD AFTER UPDATE ON ...
0
votes
1answer
24 views

Getting the value from a column during a trigger [closed]

After a test completes (on a SQL 2008R2 system), the system updates a row in the TestRun table to include an end time. I am creating a trigger that will take action after that update, and do some ...
0
votes
0answers
22 views

SQL Server 2000 - Revert trigger template to original default

In SQL Server Enterprise Manager, in the table list for a database, you can right click on a table, choose 'All Tasks' and then 'Manage Triggers ...' which will open up the following window I had to ...
3
votes
1answer
58 views

PostgreSQL: Trigger for updating view doesn't work

I'm trying to make the trigger for updating a view work. If I'm doing and INSERT it works! But when I'm trying to do an UPDATE it just doesn't run. CREATE OR REPLACE FUNCTION test_trigger_function() ...
0
votes
0answers
37 views

How do triggers work on partitioned tables?

I have partitioned a table on the basis of a column. This column can either have 0 or 1. So, only two partitions (p0, p1) have been created internally. On this table there are 3 triggers which execute ...
0
votes
0answers
51 views

Copying a table with its structure, indexes, and associated triggers?

I have studied this post on Stack Overflow: Fastest way to copy a table in MySQL. But no answer is copying everything like the table's structure, data, indexes as well as associated triggers. Is it ...
1
vote
1answer
72 views

How to get the rowid in a TRIGGER for another table in SQLite

Given the below schema CREATE TABLE Item ( _id INTEGER NOT NULL, name NVARCHAR NOT NULL, parent INTEGER NULL CONSTRAINT fk_Recursive ...
0
votes
0answers
22 views

Access Sql Server Linked Server during Logon Trigger

I am trying to log users logons to my Sql Server (A) in another Sql Server (B, different location physically), but when I try to log in I get the error Login failed ... due to trigger execution and ...
0
votes
1answer
65 views

Update query in a trigger

I have a configuration table: Table: refdatecol - id int(11) startdatecol varchar(100) enddatecol varchar(100) datecolTable varchar(100) This table holds the user configured column names ...
1
vote
1answer
65 views

Why/when does creating a mysql trigger require SUPER privileges?

I'm attempting to parse and understand what the MySQL doc says about when SUPER privileges are required for creating triggers. They say: If binary logging is enabled, CREATE TRIGGER might require ...
1
vote
1answer
114 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 ...
3
votes
2answers
62 views

How to tell what invoked a trigger in SQL Server?

I'm working on a legacy SQL Server application, with close to 3,000 tables and more than 10,000 stored procedures. One of those stored procedures is deleting some needed data from a table. I don't ...
0
votes
1answer
77 views

sql expiry date use Trigger OR Schedule a Job

I have this table : Now, i like the way when the date expires. EndTime < GETDATE() expire field is true. What method should I use? use a trigger to true or a schedule job that run before run ...