triggers

Database trigger or a common method in code?

I have a table where I want to Log activities of some part of my application. A record will be inserted (may be updated in future) in this table when record inserted/updated in some other table. E.g. If record is inserted in Orders table an entry will be inserted in Log table. If record is inserted in Booking table an entry will be in...

How can I execute .NET code from a SQL TRIGGER?

We have a website under development that maintains a database. This website is replacing classic ASP pages and FoxPro applications along with new development written in ASP.NET 3.5 (mostly VB, a little C# and some AJAX). However, there are other systems that update our database. Because of those systems that do things like updating st...

SQL 2008 Express (R2): Creating an UPDATE trigger to update a table on another server?

Hi there, I am just trying to think through a process I need where I have: One SQL 2008 express database on a webserver - takes orders into an orders table Another SQL 2008 express database on another webserver acting as a backend system to process the orders etc The idea being that the webserver database can be left to do what it d...

MySQL trigger problem

Hello, I have 2 tables: User (id, user, pass, ...) Post (user_id, post, ...) I would like to create a trigger wich delete post of a user, before deleting user... Can you help me? ...

Mysql Trigger error

1.I m using mysql 5.2.2 version 2.I create table in my test database CREATE TABLE account (acct_num INT, amount DECIMAL(10,2)); 3.I also Create trigger CREATE TRIGGER ins_sum BEFORE INSERT ON account FOR EACH ROW SET @sum = @sum + NEW.amount; 4.I insert data into account table INSERT INTO account VALUES(137,14.98),(141,1937.50),...

How to check a data row in mysql with triggers?

Hello! I want to be sure, that there are no children of children in my datatable. So if I have a parent item A, and a child item B (B.parent = A), and I try to insert a child item C to the item B (C.parent = B), this trigger have to prevent it and set the parent_id of C to A (C.parent = A). I need only 2 levels in my table (parent-chil...

Oracle 10g - Determine the date a Trigger was last updated

Hi All, Is there a way you can determine the date when a trigger was updated? The reason why I ask is because a costumer complained about receiving some erros in our application, but when I went to look at the table, it had all triggers disabled. I appreciate any help anyone can provide me! ...

django-signals vs triggers?

I read about django signals (http://docs.djangoproject.com/en/dev/topics/signals/), but as far as I understand, signals are never converted into literal SQL triggers (http://en.wikipedia.org/wiki/Database_trigger). If I'm correct that signals and triggers are different, then which one is better and in what ways? What's the best practice...

Automated registration email

To be short - User registers for the site An email is sent to the user confirming their registration I am using : Asp.net 3.5(C#) Sitefinity as a CMS MS SQL 2008 server r2 My question is what is the best way to automatically send the email? Should it be done in ASP.net or as a database trigger using something like xp_sendmail ...

Is it possible to figure out if a specific field has been updated, in a Sql Server Trigger?

Hi folks, if i have a simple table and I want to do something (say .. execute a stored proc) when a field (and i know the field i wish to look at) has changed. Is this possible? Version: Sql Server 2008 R2. Example table :- ID INTEGER PRIMARY KEY Name NVARCHAR(100) NOT NULL Age TINYINT NOT NULL HairColour TINYINT NOT NULL So .. if...

postgresql trigger when user group is changed ?

Hello, I would like to know if it is possible to have a trigger when a user is added to or drop from a group ? Does this trigger could also works when dierctly create a user in a group (create role ... in group ...) ? (In fact, I want some users of a specified group to have a specific search_path, so I can set/reset the search_path in th...

Design-time problem with custom behaviors and triggers in Silverlight

I have implemented a few custom behaviors and triggers and added them via XAML. They work fine at run time but prevent the Cider designer view from loading at design time, and presumably will cause a problem in Blend too, though I haven't confirmed that. Here is an overview of what I've implemented for one of the behaviors; hopefully so...

jQuery Trigger event fires multiple times

I'm trying to get a jQuery lightbox to load up when a page loads. I got half way there. The lightbox opens when the page loads but then proceeds to open the link in the same window as a full page. How do I get it to stop at this point before loading the link in a separate window. jQuery: $(document).ready(function(){ $("a.greybox").b...

SQL Constraint/trigger - Is it possible to write a constraint that checks "when you Insert a record it must contain one of two fields"?

Is it possible to have a constraint/trigger on a record being entered that checks if the user has entered at least one of three fields (all of which can be null). For example, I have a database being used to track bugs and new features in other pieces of software. When a bug is discovered a Feature record is created which can have three ...

How to create a trigger with multiple actions in MySQL 5.0.45?

I'm working in phpMyAdmin and I'm new to creating MySQL 5.0.45 triggers. I'm trying to create a trigger that will help me validate data by throwing an error when a value it out of range. This works just fine: create trigger t1 before insert on hvi for each row begin declare dummy int; if new.`Moist (dry%)` <1 then select `Moist(dry%) c...

translate from SQL Server to Oracle

I was hoping one of you Oracle experts would be able to give me a hand with this. I have the following SQL Server script, but I need to rewrite it for Oracle: USE mydb GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE trigger mydb . [CONNECTERTRIGGER] on mydb . [DtreeNotify] FOR INSERT AS BEGIN IF @@ROWCOUNT=0 RETURN SET I...

Mysql trigger to do an INSERT instead of an UPDATE

Hello, I would like to implement a basic versioning system in a MySQL table. Let's imagine a simple table with 2 columns: name (pk) and price. I thought I would simply add a column 'version' and add it to the primary key. Then I would catch all the UPDATE's and do an insert instead, incrementing the version number. First, is this pos...

Make a query in mysql without invoking a trigger (How to disable a trigger)

I have 2 tables: comments and comments_likes. comments id message likes triggers: AFTER DELETE DELETE FROM comments_likes WHERE comment_id = OLD.id; comments_likes id comment_id triggers: AFTER INSERT UPDATE comments SET likes = likes + 1 WHERE comments.id = NEW.comment_id; AFTER DELETE UPDATE comments ...

How can I edit values of an INSERT in a trigger on SQL Server?

I have the table Tb ID | Name | Desc ------------------------- 1 | Sample | sample desc I want to create a trigger on INSERT that will change the value of the inserting Desc, for example: INSERT INTO Tb(Name, Desc) VALUES ('x', 'y') Will result in ID | Name | Desc ------------------------- 1 | Sample | sample desc 2 | x ...

WPF - Setting Custom tooltip using style triggers

I am trying to display tool tip to a stack panel based on property HasValidationError. <Style TargetType="StackPanel" x:Key="stackstyle"> <Style.Triggers> <DataTrigger Binding="{Binding HasValidationError}" Value="True"> <Setter Property="ToolTip"> <Setter.V...