triggers

SQL trigger for audit table question

I am writing a trigger to audit updates and deletes in tables. I am using SQL Server 2008 My questions are, Is there a way to find out what action is being taken on a record without going through the selection phase of the deleted and inserted tables? Another question is, if the record is being deleted, how do I record within the au...

run a .exe file on updating a word document on the same computer

i dont know if this is possible, but i need to do the following. When i make changes to a word document on my pc (save it and the date changes everytime), I want a .exe file on the same computer to run. Is there any way or third party software, with which i can achieve this? ...

PostgreSQL, triggers, and concurrency to enforce a temporal key

I want to define a trigger in PostgreSQL to check that the inserted row, on a generic table, has the the property: "no other row exists with the same key in the same valid time" (the keys are sequenced keys). In fact, I has already implemented it. But since the trigger has to scan the entire table, now i'm wondering: is there a need for...

how to change the delimiter in sqlplus in oracle 11g

I want to change the delimiter: Can someone help me to change the delimiter in sqlplus in Oracle 11g CREATE OR REPLACE TRIGGER test_trigger BEFORE INSERT ON test REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT test_sequence.nextval INTO :NEW.ID FROM dual; END; / this is the trigger I want to create. but after Select statement...

Get current updated column name to use in a trigger

Is there a way to actually get the column name that was updated in order to use it in a trigger? Basically I'm trying to have an audit trail whenever a user inserts or updates a table (in this case it has to do with a Contact table) CREATE TRIGGER `after_update_contact` AFTER UPDATE ON `contact` FOR EACH ROW BEGIN INSER...

quartz cron expression help (daily trigger)

Hi, i want to run a cron trigger every 5th day starting from the 16th of every month. so it should execute on every: 16th, 21st, 26th, 31st, 5th, 10th, 15th, 20th and so on i tried "0 0 1 16/5 * ?" but this gets execute on 16th, 21st, 26th, 31st, 16th, 21st.... It skips anything between 1st and 15th. Please help. thanks ...

mysql and trigger usage question

I have a situation in which I don't want inserts to take place (the transaction should rollback) if a certain condition is met. I could write this logic in the application code, but say for some reason, it has to be written in MySQL itself (say clients written in different languages will be inserting into this MySQL InnoDB table) [that's...

PostgreSQL triggers and passing parameters

This is a multi-part question. I have a table similar to: CREATE TABLE sales_data ( Company character(50), Contract character(50), top_revenue_sum integer, top_revenue_sales integer, last_sale timestamp) ; I'd like to create a trigger for new inserts into this table, something like this: CREATE OR REPLACE FUNCTION add_cont...

How to MySQL Trigger to update a field whenever any record is touched?

I haver zero experience with triggers in MySQL. Learnt them in school (Oracle environment). I have a table which already has a datestamp column for insert date. I want to update a Record_Touched field whenever any record is touched in this table. What is the best efficient way of doing it? Thank you... ...

What is the scope of CONTEXT_INFO in SQL Server?

I am using CONTEXT_INFO to pass a username to a delete trigger for the purposes of an audit/history table. I'm trying to understand the scope of CONTEXT_INFO and if I am creating a potential race condition. Each of my database tables has a stored proc to handle deletes. The delete stored proc takes userId as an parameter, and sets CON...

Can anyone tell me what is wrong with my create trigger syntax?

I am experimenting with triggers for the first time. When I try to create a trigger using the following: CREATE TRIGGER t_foldersPrivate BEFORE DELETE ON foldersPrivate FOR EACH ROW BEGIN DELETE FROM programs WHERE folderType = '0' AND folderID = OLD.ID; END; I receive the following error: `1064 - You have an error in your SQL sy...

Determine caller within stored proc or trigger

I am working with an insert trigger within a Sybase database. I know I can access the @@nestlevel to determine whether I am being called directly or as a result of another trigger or procedure. Is there any way to determine, when the nesting level is deeper than 1, who performed the action causing the trigger to fire? For example, w...

Function call within XAML code?

I'd like to set a style on all my TextBox controls that does the following when it receives keyboard focus: 1) Change the background color 2) Call .SelectAll() to highlight all text I have this so far: <Style TargetType="TextBox"> <Style.Triggers> <Trigger Property="IsKeyboardFocusWithin" Value="True"> <Se...

triggers for generating userID based on user's information.

I have complaint table 1. tblProfile with columns userId | name | age | address | mobileno | 2. tblUserId with columns userId | role | status now when user fills the form I want to insert one row in tblProfile, before inserting a new row I want to create userId by combining starting letters of name and mobile no and then insert into tbl...

When are database triggers bad?

Possible Duplicate: Are database triggers evil? There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. ...

How to make hudson build only most current build.

Question How do I setup Hudson so that if one person triggers a build, Hudson will put it on the queue and wait lets say 2 minutes, and during those 2 minutes if another build is triggered it will replace the older build on the queue with the new build? This way if there are 2 builds in those 2 minutes, Hudson will only perform the l...

how to list out all triggers in a particular table OR database?

how can I list out all triggers on a table? ...

how to create before update trigger in sql server 2005

Is there anyway where I can create a trigger which will execute before the update/delete takes place( and then the actual update/delete takes place)? and how can I drop a trigger from a table? ...

How do I exit a series of If / else conditions in a mysql trigger?

I have a trigger that checks to see if certain fields changed during the update. If any of these fields changed I update another table. I'd like to "break" out of the if conditions as soon as I know that something changed. Is there a way to do this within a MySQL Trigger? What I have works, but It seems inefficient. CREATE TRIGGER pr...

Problems with mysql syntax

I´m trying to create a trigger on MySQL but I´m having a syntax problem, which I was not able to find. If someone more experience could help me it would be great (it´s the first time I use MySQL!)... The reason why I´m creating this trigger is for deleting all the orphan "labels", which has a many-to-many relation with "service_descript...