Procedural code automatically executed in response to a database event.

learn more… | top users | synonyms (1)

0
votes
0answers
10 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 plan is this: Archive column, smallint - 0=new (default ...
0
votes
2answers
26 views

SQL Server De-duplication Trigger

I have a table that contains columns of Country, City, Location, Description. Due to the size of the description field it's not possible to bind the four fields into a composite key to prevent ...
1
vote
1answer
35 views

how to define trigger scope variable [on hold]

My trigger is meant to calcalute the grade of a student base on the column value for every insert.But if a column value for the column is modified it the corresponding Grade should change. Currently i ...
1
vote
1answer
50 views

Can I trigger events based on timestamp data or should I use polling?

I'm asking this question for SQL Server 2008+ but this could really be for any DBMS. Imagine you have scheduled data, something like: ID Data Timestamp 0 NULL 2014-11-22 1 ... ...
1
vote
2answers
27 views

Schema/Structure to handle secondary computed data

I'm trying to design a LAMP-based website for my pinball league, which plays competitive pinball every week in match play. One of the features of our league is that we convert raw scores to ...
0
votes
2answers
59 views

How to update a column with values from the same newly inserted row on a SQL Server 2014 trigger?

Using SQL Server 2014, I have this: Table1 Tab1_id int identity(1,1) primary key Tab1_val1 smallint Tab1_val2 smallint Tab1_valInfo varchar(10) -- not yet implemented, will be used ...
0
votes
1answer
12 views

Triggering a shell script from MySQL without any 3rd party libraries

Is it possible to call a bash script file in linux using a trigger in MySQL? I've been searching for the answer online and I ran into this articles: ...
0
votes
0answers
17 views

mysql trigger help

I need to create a MySQL trigger. I don't know very well MySQL syntax but I've written something, maybe you would understand what I need, I need to insert the difference from 2 rows into a new row, ...
2
votes
3answers
107 views

Passing info on who deleted record onto a Delete trigger

In setting up an audit trail I have no problem tracking who is updating or inserting records in a table, however, tracking who deletes records seems more problematic. I can track Inserts/Updates by ...
-1
votes
2answers
34 views

I can't find the problem? [closed]

CREATE TRIGGER request_internal_trigger AFTER INSERT ON request_internal_analysis FOR EACH ROW BEGIN INSERT INTO user_action (User_Name , Request_number , Actions , DateOfAlter , ...
1
vote
2answers
96 views

Assign to NEW by key in a Postgres trigger

In the trigger body, how can I assign a value to NEW by it's field name? That's what I want to do: some_key = "some_column"; NEW[some_key] = 5;
-1
votes
1answer
48 views

SQL Server 2008 Trigger

New to triggers. I have two tables. One for users & other for circulated mails. The circulated mails table has [Sender, Receiver...] users table has [Personal Number, Names, Email]. when we have ...
0
votes
2answers
100 views

Best way to get the most recent insert from a table (SQL Server)

I have an app (which I have no control of) that writes the status (success or failed) of the file transaction to tableA in a DB on SQL Server 2008. I basically want to grab the most recent insert in ...
0
votes
0answers
29 views

mysql trigger Update a row after insert according to condition

I am writing a MySQL trigger. In which I would like to update branch_form_no with auto increment form number according to branch id. How should I do? I have table hcm_staffing_applicantform with ...
2
votes
0answers
46 views

AFTER DELETE trigger will not fire during a cascade delete

I've got two tables, corresponding to Nodes in a graph and Aisles to which they may belong. In addition, each Aisle has a Node at which it starts and ends. Aisle Table: Aisle char(4) Start_Node ...
1
vote
1answer
24 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
21 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
22 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
46 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
37 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
33 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
57 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
26 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
93 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
40 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
113 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
67 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
62 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
55 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 ...
2
votes
1answer
46 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
77 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
37 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
32 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
23 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
51 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
90 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
51 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
23 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
65 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
40 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
91 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
49 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
80 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
105 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
60 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
62 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
22 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
76 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 ...