triggers

T-SQL Update trigger with multiple rows

Hi ! Consider a trigger after update on the table A. For every update the trigger should update all the records in table B. Then consider this query: UPDATE A SET X = Y Apparently there are many rows updated. After the update the trigger takes place. Now if the trigger would be using inserted table, and you would like to update the ...

TSQL Create trigger with transaction and try catch block

Hi ! i have some questions about a transaction in the trigger, for which I haven't found an answer yet. CREATE TRIGGER A_AI ON A AFTER INSERT AS BEGIN TRY --is the try block 1 transaction ? or do I have to begin the transaction? --BEGIN TRAN: may I start the transaction like this? -- SOME DANGEROUS OPERATIONS ...

Delete trigger as replacement for "ON DELETE CASCADE" to avoid "multiple cascade paths"?

The following table definition: CREATE TABLE Customers( id INT NOT NULL PRIMARY KEY, name [varchar](50) ) CREATE TABLE Orders ( id INT NOT NULL PRIMARY KEY, customer INT FOREIGN KEY REFERENCES Customers(id) ON DELETE CASCADE ) CREATE TABLE OrderDetails ( id INT NOT NULL ...

Access sql that triggered the trigger from within trigger (Sybase)

Is there a way to access the sql that triggered a trigger from within the trigger? I've managed to get it by joining to the master..monProcessSQLText MDA table but this only works for users with the mon_role and I don't want to give that to everyone. Is there a global variable I've missed? I'm trying to log all the updates run against...

How to replicate :new trigger functionality from Oracle to Sybase

I am trying to convert code from Oracle to Sybase, where there are manipulations occurring on the :new.x values. These triggers are BEFORE INSERT, so whatever changes in the :new values are replicated in the insert into the table the trigger is placed on. The Sybase triggers are fired after insert, but I can't seem to work out how to ge...

Class name change Event in jQuery

Hi, Is there a way to trigger a event in jQuery when an elements classes are changed? Examples: <img class="selected" /> into <img class="selected newclass" /> triggers an event And <img class="selected" /> into <img class="" /> trigger an event ...

'Setter' object cannot be added to 'EventTrigger' ?

Hi, I get the following error on the WPF code bellow: 'Setter' object cannot be added to 'EventTrigger'. The given object must be an instance of TriggerAction or a derived type. <Style x:Key="LinkLabel" TargetType="{x:Type Label}"> <Setter Property="FontFamily" Value="Tahoma"/> <Setter Property="FontSize" Value="12"/> <Se...

Will an AFTER trigger in Postgres block an insert/update?

If I set up an AFTER trigger in PostgreSQL to fire after an insert/update, will the calling software have to wait for the trigger to finish before returning control to the calling software? Or will the trigger run on its own behind the scenes? ...

T-SQL: Double-cocked Trigger, Polling or a .NET Async Thread?

So i bet i got you curious with that title. =) Here's the scenario - simplified for the cause. Website: ASP.NET 4 Web Forms. Database: SQL Server 2008. DAL: LINQ-SQL. In the DB, we have two tables: Foo and Bar. Relationship is 1-1, and Bar has a foreign key constraint to Foo. In other words, you need to create Foo first, then use t...

Refresh updatepanel through triggers when other updatepanel does because the first must have UpdateMode=Conditional

Hello, I have some updatepanels in asp.net page. I want updatepanel 2 get refreshed when updatepanel 1 does, but UpdatePanel 2 has his UpdateMode attributed set to Conditional and ChildrenAsTrigger=False, because it has another updatePanels inside and i need to control the way it is refreshed. I was trying to make a trigger for the oth...

Switching execution context inside logon trigger

I have a database called MyDB in a Microsoft SQL Server 2008 Express instance using mixed mode authentication. The application using the database MyDB currently connects using Windows Authentication, using the current user's Windows credentials. This login is a member of the 'public' server role, and has a user mapped to it in the MyDB d...

how to trigger Live() click in jquery

Hi everybody, I have an interesting situation, I need to trigger a live click , because simple click doesn't work . this is what I have: $('.text').trigger('click'); but i need something like this : $('.text').trigger(live('click' ...)); or something to fix this problem this is my code : $(".Sets a.largeImage").fancybox({ ...

SQL script how to add a tab or new line within script

I have a SQL script that acquires table names and creates trigger for those tables. When I open the trigger after creating it all of the code is on one line. How would I go about adding tab and new line characters within the script to make the trigger more readable. Example code: SET @SQL = 'ALTER TRIGGER [dbo].[TRG_' + SUBSTRING(@TABL...

using triggers for ensuring data consistency

I have a hierarchical structure stored in a table. Each element has a pointer to its previous, next and a parent create table CATALOGUE ( NAME VARCHAR2(300) not null, NEXT_ID NUMBER(38), PARENT_ID NUMBER(38), PREVIOUS_ID NUMBER(38), XID NUMBER(38) ); I have a java application, which uses O/R mapping to access and modify this...

SQL update/delete trigger not working properly

I have a trigger that is used for auditing inserted, updated and deleted rows. I am having an issue with acquiring the Old Values and New Values from the trigger. The trigger utilizes a loop to insert all values of any row that has been altered in any way (inserted, updated, deleted). However, my code is not returning the values but inst...

How to set a Trigger on a child to a parent property?

I have a TreeView with a ToggleButton ( ExpanderButton ). The togglebutton has a two images ( one for expanded and one when not ). However when I select a TreeViewItem I highligh it with a different color and I'd like to change the color of the images as well ( I have the same ones in the other color ). Problem is I don't know how to se...

Trigger on INSERT ON DUPLICATE KEY

I have a simple question. Ive got a trigger to insert the values into another Database So for example if there are two values and the trigger is checking the value in Table A and inserting into Table B So here is the code -- Trigger DDL Statements USE `db`; DELIMITER // CREATE DEFINER=CURRENT_USER() TRIGGER `db`.`AFTER_INSERT_A` AFTE...

Silverlight 4 and DataTemplate.Triggers

Hi All, I'm trying to show the Master/details scenario in SL4. I have a DataGrid as master and ContentControl as the Child/detail and I want is to select the ContentTemplate to be picked up based upon the [ProductTemplate] Property Value of the currently Selected Item in the DataGrid. Also within that DataTemplate I have DataForm and a ...

SQL Server Update trigger for bulk updates

Below is a SQL Server 2005 update trigger. For every update on the email_subscriberList table where the isActive flag changes we insert an audit record into the email_Events table. This works fine for single updates but for bulk updates only the last updated row is recorded. How do I convert the below code to perform an insert for ever...

Cocos2D iPhone Repeating Buttons

Hello. Using Cocos2D, is it possible to create a button which constantly triggers when being touched, instead of triggering just once? I'm happy to have a timer which does the repeat trigger, so I guess another question is can I use a touch removed with a Cocos2D menu button? Cheers. :-) ...