triggers

Perforce trigger to deny submission of unchanged files?

Perforce allows people to check in unchanged files. Why any version control system would allow this is beyond me, but that's a topic for another question. I want to create a trigger that will deny the submission of unchanged files. However, I have no experience with Perforce triggers. From what I've read, I'm guessing this would be a ...

T-SQL - Is there a way to disable a trigger in the scope of a transaction?

In SQL Server 2005, is there a way for a trigger to find out what object is responsible for firing the trigger? I would like to use this to disable the trigger for one stored prodecure. Is there any other way to disable the trigger only for the current transaction? I could use the following code, but if I'm not mistaken, it would affect...

Can you use routed events with a MultiTrigger?

Does WPF support using a triggers that respond to routed events but only given a condition is met? For example, WPF supports triggering on routed events through Event Triggers. ie: <Button> <Button.Triggers> <EventTrigger RoutedEvent="Click"> ... </.. </.. </.. However I am looking for the trigger to go off only giv...

How to constrain a database table so only one row can have a particular value in a column?

Using Oracle, if a column value can be 'YES' or 'NO' is it possible to constrain a table so that only one row can have a 'YES' value? I would rather redesign the table structure but this is not possible. [UDPATE] Sadly, null values are not allowed in this table. ...

In WPF Style, How can Trigger access a son Element of the Element it is attatched

The following is a Simple Style for ListBoxItem, ListBoxItem has a son Border. Border has a Padding property with value of 8, I want to change the value to 0, when the item is selected. How can I write the trigger? <??Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Transparent" /> <Sette...

Trigger a keypress with jQuery...and specify which key was pressed

I would like to have an input element (type=text) or textarea element that validates dynamically by triggering specific keystrokes. This will be used for Chinese pinyin input, so for example: The user types "ma2" into an input element. The keydown event triggers for every keystroke, and the 2 never appears. Instead, when the user pre...

Are Sql Triggers synchronous or asynchronous?

I have a table that has an insert trigger on it. If I insert in 6000 records into this table in one insert statement from a stored procedure, will the stored procedure return before the insert trigger completes? Just to make sure that I'm thinking correctly, the trigger should only be called (i know 'called' isn't the right word) once b...

How do I get a button that is inside an asp:UpdatePanel to update the whole page?

I have a button inside an update panel that I would like to update the whole page. I have set ChildrenAsTriggers="false" and UpdateMode="Conditional". I have some sample code here that demonstrates my problem. <asp:UpdatePanel ID="myFirstPanel" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional"> <ContentTemplate> ...

My MySQL after INSERT trigger isn't working? Why?

I've created a trigger that resembles the following: delimiter // CREATE TRIGGER update_total_seconds_on_phone AFTER INSERT ON cdr FOR EACH ROW BEGIN IF NEW.billsec > 0 AND NEW.userfield <> NULL THEN UPDATE foo SET total_seconds = total_seconds + NEW.billsec WHERE phone_id = NEW.userfield; END IF; END;// It seems to go through okay...

Working without stored procedures or triggers

We have been working on a complex database and client interface for the last 18 months. We are regularly adding new functionnalities to this application, and it is now used by tens of users on a daily basis in all our offices, including sites and overseas. This is just to tell you it is a REAL application with a REAL database. Until now...

TRIGGERs that cause INSERTs to fail? Possible?

In cleaning up this answer I learnt a bit about TRIGGERs and stored procedures in MySQL, but was stunned that, while BEFORE INSERT and BEFORE UPDATE triggers could modify data, they seemingly couldn't cause the insert/update to fail (ie. validation). In this particular case I was able to get this to work by manipulating the data in such ...

CREATE TRIGGER is taking more than 30 minutes on SQL Server 2005

On our live/production database I'm trying to add a trigger to a table, but have been unsuccessful. I have tried a few times, but it has taken more than 30 minutes for the create trigger statement to complete and I've cancelled it. The table is one that gets read/written to often by a couple different processes. I have disabled the ...

How do I cancel a Delete in SQL

I want to create a trigger to check what is being deleted against business rules and then cancel the deletion if needed. Any ideas? Update The solution used the Instead of Delete trigger. The Rollback tran stopped the delete. I was afraid that I would have a cascade issue when I did the delete but that did'nt seem to happen. Maybe a tri...

WPF Trigger for IsSelected in a DataTemplate for ListBox items

Hi, I have a listbox, and I have the following ItemTemplate for it: <DataTemplate x:Key="ScenarioItemTemplate"> <Border Margin="5,0,5,0" Background="#FF3C3B3B" BorderBrush="#FF797878" BorderThickness="2" CornerRadius="5"> <DockPanel> <DockPanel DockPanel.Dock="Top" Margin="0,2,0,0"> ...

MouseOver highlighting style returning to default after a second (Caused by Aero?)

I'd trying to style my ComboBoxes to match the rest of the UI but I'm having problems with the IsMouseOver highlighting. It highlights with the color I specify for a second and then fades back to the default color, kind of a cool effect but not what I'm going for. Here is my style: <Style TargetType="ComboBox"> <Style.Triggers> ...

What is the best way to execute an MS SQL Server 2000 DTS package from a trigger?

I looked around and found some ideas about how to do this, but no definitive best way. One of the ideas was to use sp_start_job to kick off an SQL Server Agent job that runs the DTS package. If this is the best way to do it, then the next question would be, "How do I schedule a DTS package from a job and make it non-recurring?" Thanks...

Altering a trigger in Sql Server 2005

I need to alter a trigger in sql server 2005 and I want to do it using a table adapter and a sql statement, not a stored proc. I know I could run this in the query browser and execute it but I need to deploy it across several databases and use a table adapter in the update. Is this possible? Doing Add Query -> Update -> pasting the belo...

Foreign key referencing composite table

I've got a table structure I'm not really certain of how to create the best way. Basically I have two tables, tblSystemItems and tblClientItems. I have a third table that has a column that references an 'Item'. The problem is, this column needs to reference either a system item or a client item - it does not matter which. System items h...

Scope of Oracle transactions when used from ADO.NET and involving triggers?

I am told by someone that when calling Oracle from ADO.net, when calling multiple inserts in a loop, where each insert causes a trigger to fire that includes within it's PL-Sql a Commit statement, that it is impossible to stop that commit from actually commiting the transaction. i.e., I want my ADO.Net code to begin a transaction before...

SQL Server Triggers Firing Each other Question

I have an auditing trigger that automatically places the time something was updated and the user that updated in fields in all my tables. I have another set of triggers that write event information from updates to an events table. The issue is when someone updates something, the event information is fired twice because of the first trigg...