triggers

Applying style to row above

I've created quite a satisfying 'magnifying glass' effect on a list view <Trigger Property="IsMouseOver" Value="True"> <Setter Property="FontSize" Value="14"/> </Trigger> However, what I'd really like to do is have the rows above and below set to, say, 12. I suspect this is asking a bit to much, but just in case anyone has an ide...

Displaying xaml resources dynamically?

I used Mike Swanson's illustrator to xaml converter to convert some of my images to xaml. The convert creates a viewbox that contains the image. These viewboxes I made resource files in my program. The code below shows what I'm trying to do: I have a viewmodel that has an enum variable called PrimaryWinding of type Windings. The values...

Sql Server 2008 - BEFORE triggers?

Hi all... I've long been waiting for BEFORE triggers. But we have some systems which are written in ORACLE. When a potential new client asked why, our president told them that it was because there are no BEFORE triggers in Sql Server (among other things). To this, the client responded, "Yes, in 2008 you CAN write BEFORE triggers." No...

Saving the USER_ID of a user that deleted a record with a trigger in MySQL

I'm trying to set up a series of history triggers to automatically collect history for a given table via triggers. I want to use triggers as this guarantees I capture all changes regardless if someone forgets about saving it in the app. My problem is that I have this trigger. CREATE TRIGGER `db`.`delete_history_trigger` BEFORE DELETE ON...

Sql server: update new record on insert

Using the "Northwind" sample: I would like to create an insert trigger on the OrderDetails table so that every time an OrderDetail is inserted, it gets the current value of the UnitCost as defined in the Products table. It should be something like this, but I have trouble to get it right. Can you help ? CREATE TRIGGER Trigger1 ON Ord...

What do references to OLD evaluate to in the WHEN cause of an Oracle insert trigger?

When writing a row-level trigger in Oracle, I know that you can use the OLD and NEW pseudo-records to reference the old and new state of the row that fired the trigger. I know that in an INSERT trigger OLD doesn't contain any data, but I'm not sure how this affects the evaluation of a WHEN clause for that trigger. For example, if I have ...

sql server 2005 - trigger to hash password at insertion

How could i create a trigger that at any insertion on my table [users] will change automatically the content of its [password] field to its MD5 hash? Ps: I do not want this being done at client side. ...

Loop in trigger SQL Server

I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET NOCOUNT ON; --delete user uploads update my_gallery set deleted=1 where un=(select un from deleted) and subdomain=(select subdomain from deleted) --delete user pms delete from pms where toUn=(select un from deleted) and subdomai...

Disable Enable Trigger SQL server

I want to create one proc like below but it has error on syntax. Could anyone pointing out the problem? Create PROCEDURE [dbo].[my_proc] AS BEGIN DISABLE TRIGGER dbo.tr_name ON dbo.table_name -- some update statement ENABLE TRIGGER dbo.tr_name ON dbo.table_name END ** Error Message : Incorrect syntax near 'ENABLE'. ...

Is there a way to use an Env Variable from CCRC to a non-interactive trigger?

Hi! I have a (clearcase) preop non-interactive trigger that needs to evaluate an environment variable value (from client side) in order to perform some checks. Is there a way or w/a to pass such environment variable value from client with CCRC to the trigger, considering it seems to do not work as with dynamic or snapshot view? Thanks...

How do I track down what's re-enabling triggers during my SQL*Loader load?

I seem to be seeing a lot of messages like this in my log: Trigger DEV."MBR_TRG" was disabled before the load. Trigger DEV."MBR_TRG" was re-enabled by another process. SQL*Loader-951: Error calling once/load initialization ORA-00604: error occurred at recursive SQL level 1 ORA-00054: resource busy and acquire with NOWAIT specified Thi...

How can I write a trigger in mysql that after an insert to the table deletes the row?

I've got an after insert trigger that works good. However, I want it to delete the row after it's been inserted and after the main body of the trigger completes. How can I do that? I have a unique id in the table. ...

Notify my WCF service when my database is updated

Hi all. I have a WCF service that needs to notify it's clients when changes occur to the database (sql server 2005). This is relatively easy accomplished, as long as I find a way to notify my service of any changes. I can probably create a database trigger on a table and have that trigger start a small service client that notifies my se...

Check constraint on table lookup

Hi, I have a table, department , with several bit fields to indicate department types One is Warehouse (when true, indicate the department is warehouse) And I have another table, ManagersForWarehouses with following structure: ID autoinc WarehouseID int (foreign key reference DepartmentID from departments) ManagerID int (foreign key r...

postgres update a date field when a boolean field is set to true

For the sake of the example, consider a table create table foo ( contents text NOT NULL, is_active boolean NOT NULL DEFAULT false, dt_active date ) I insert a record: insert into foo (contents) values ('bar') So far, so good. Later on, I now want to 'activate' the record: update foo set is_active = true What I would like t...

PostgreSQL simple trigger question

trigger: CREATE TRIGGER "tr_update_ts" BEFORE INSERT OR UPDATE ON "public"."test" FOR EACH ROW EXECUTE PROCEDURE "public"."update_ts"(); and the function is: CREATE OR REPLACE FUNCTION "public"."update_ts" () RETURNS trigger AS $body$ DECLARE BEGIN NEW.ts := now(); RETURN NEW; END; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON ...

Find out which tables were affected by Triggers

In MySQL (particularly InnoDB) is there any way to know which tables were affected (updated / deleted rows) by CASCADE UPDATES / DELETES or regular triggers? ...

Oracle: excluding updates of one column for firing a trigger

In oracle I can specify the columns, which should induce a firing of a trigger: create or replace trigger my_trigger before update of col1, col2, col3 on my_table for each row begin // the trigger code will be executed only if col1 or col2 or col3 was updated end; Now I want to do the following: I don't want the trigger to fire, whe...

sql trigger disappears

I've got a trigger in a sql server table. This trigger has disappeared. Is there something systematic that might be causing it to be deleted? There is no replication on this db. ...

SCOPE_IDENTITY And Instead of Insert Trigger work-around

OK, I have a table with no natural key, only an integer identity column as it's primary key. I'd like to insert and retrieve the identity value, but also use a trigger to ensure that certain fields are always set. Originally, the design was to use instead of insert triggers, but that breaks scope_identity. The output clause on the insert...