triggers

Oracle grant concession and side effects

Working every day on a large Oracle production database (10g), we noticed that operations like granting an user read privileges on a table creating a trigger on a table lock that table, and invalidate all the cursors insisting on it. This has tremendous consequences if the table is big (> 20 million rows) and many users are working ...

Triggers are they asynchronous ?

I have a table A which maintains count of total users in Table B. All I care is that the count in Table A is in sync with the number of users in the table B. So, whenever I insert a user in Table B, I want the count to be incremented/decremented depending on insert of user or delete. There are two ways:- a) In case I am inserting the...

What operation type invoked a trigger in SQL Server 2008?

I'm contemplating a single SQL trigger to handle INSERT, UPDATE and DELETE operations as part of an auditing process. Is there any statement, function or @@ variable I can interrogate to find out which operation type launched the trigger? I've seen the following pattern: declare @type char(1) if exists (select * from inserted) if ...

Rejecting files with Windows line endings using Perforce triggers

Using Perforce, I'd like to be able to reject submits which contain files with Windows line endings (\r\n IIRC, maybe just \r anywhere as really we only want files with Unix line endings). Rather than dos2unix incoming files or similar, to help track down instances where users attempt to submit files with Windows line endings, I'd like ...

Trigger on ContextMenu.IsOpen in XAML

Hello. Here's what I'm trying to do: <Style x:Key="TreeViewItemStyle"> <Setter Property="TreeViewItem.ContextMenu" Value="{StaticResource ContextMenu}" /> <Style.Triggers> <Trigger Property="TreeViewItem.ContextMenu.IsOpen" Value="True"> <Setter Property="TreeViewItem.BitmapEf...

Drop ALL triggers from Postgres DB?

Is there any way to drop ALL triggers from ALL tables in Postgres? I know there's a pg_trigger table I could look at, but it doesn't look like it contains enough information for me to decipher which triggers I have added to my tables. It also looks like Foreign Key constraints show up in the pg_trigger table, which I DO NOT want to drop...

SQL Trigger insert

Hi Guys, What is the best way to set up a trigger to get all new rows in a table and insert them into a work queue table. Many Thanks Sp ...

Create Trigger to log SQL that affected table??

I'm trying to find out what is updating the value of a column and i have very little knowledge of the application. At a quick glance I've noticed about 90% of the applications business logic is handled on the database. Needless to say the depth of SP's, functions, and triggers is crazy. I'd like to create a trigger on the table in quest...

clear case trigger

Hello, Does someone knows how to create a trigger in Clear case, that will never allow checking out a file named x or y or j, in case this file is already checked out by someone else. I want to not allow unreserved checkout for few of my files. Thanks ...

Trigger is not working on LInked Server. Both servers are SQL Server 2005

I have link a server with another server. I can access records from linked server and I can also insert record using INSERT statement like INSERT INTO [LINKED-SERVER-IP].MyDb.dbo.Customer (CustomerId, CustomerName) SELECT CustomerId, CustomerName FROM MyCustomers WHERE CustomerId = 5 Above query work ok and insert record but when I us...

Problem creating SQLite trigger

Hi. I have a table called posts having an INT field posted and a table domains having field posted too, this one is supposed to be the sum of a posteds of posts belonging to a certain domain. Whether the post belongs to a domain is determined by a foreign domain_id in the table posts which links to the id in domains. I'm trying to create...

SQL Server Delete Trigger To Update Multiple Columns in Same Table

I have the following trigger: CREATE TRIGGER Users_Delete ON Users AFTER DELETE AS BEGIN SET NOCOUNT ON; -- Patients UPDATE Patients SET ModifiedByID=NULL WHERE ModifiedByID=ID; UPDATE Patients SET CreatedByID=NULL WHERE CreatedByID=ID; UPDATE Patients SET DeletedByID=NULL WHERE DeletedByID=ID; END I wa...

Simultaneous Triggers in SQL Server

In Microsoft SQL Server : I've added an insert trigger my table ACCOUNTS that does an insert into table BLAH based upon the inserted values. The inserts come from only one place, and those happen one at a time. (By that, I mean, that there's never two inserts in a transaction - two web users could, theoretically click submit and have th...

SQL Server row level triggers

I tried to achieve row level delete trigger by using cursor but when in trying yo delete the any row from table it tooks so long time. I could not understand where exactly it stuck. /****** Object: Trigger [delStudent] Script Date: 06/24/2010 12:33:33 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER [delStud...

how to trace mysql trigger or help with this one.

Hello everyone, Is there a way to trace MySql triggers? I am stuck with the following one. I want to calculate a column before insert concatenating two other columns, but there is problem calculated value is always null, i also need to check if one column has comma separated values, in that case i only want the first one, here is the ...

Variable containing the number of rows affected by previous DELETE? (in a function)

I have a function that is used as an INSERT trigger. This function deletes rows that would conflict with [the serial number in] the row being inserted. It works beautifully, so I'd really rather not debate the merits of the concept. DECLARE re1 feeds_item.shareurl%TYPE; BEGIN SELECT regexp_replace(NEW.shareurl, '/[^/]+(-[0-9]+\.html)$',...

How to prevent an Insert Trigger from being fired when no row is inserted ?

I have a TABLE1. On this table I created a trigger : AFTER INSERT OR UPDATE OR DELETE Now, if I do an insert which doesn't insert anything, the trigger will still be fired : insert into TABLE1 select * from TABLE1 where 1=0; This query will insert NO ROWS but yet the trigger is still fired. Is there a way to avoid this ? Is this no...

mimicking triggers in LINQ

Hi everyone, I have a question about implementing triggers at hi level, c# .net code; Is that possible at all? I have to develop a browser on exiting database. I need to have some triggers on some of tables and I cannot,allowed, do this with sql trigger commands? I am using linq for achieveing other functionalities and making connection...

jQuery AJAX document trigger?

Hi, My jQuery code: $('.Img').click(function() { alert('Test'); }); $().ready(function() { $.ajax( { type : 'POST', url : 'Post.php', success : function(Response) { $('#Response').html(Response); } } }); My HTML code: <div id="Response"></div> <img class="Img" src="blan...

How do i dynamically create a job schedule in a trigger?

I am creating a library system. When a book is reserved, i want it to automatically change the status back to "Available" in 3 days if the reserved user does not borrow it. I can create a trigger to fire when the status is changed to "Reserved" but I am lost on creating a job to happen in 3 days and change the status back to "Availabl...