triggers

How to enable a button when a treeview-item has selected?

Hello, I have a treeview and a button. I want to disable the button (IsEnabled=false) when there is NO item selected in the treeview (and I want to enable the button when there is an item selected...). How can I do this???? Here is my Xaml. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="...

Running trigger that calls stored procedure on another database

We would like to run a trigger on one database (A) that calls a stored procedure on another database (B). CREATE TRIGGER trg_A ON TableA FOR INSERT AS BEGIN EXEC DatabaseB.dbo.stp_B END We would like to do this as LoginA with UserA on DatabaseA. We also have LoginB with UserB on DatabaseB. How can we accomplish this? Currently w...

What comparison method is better?

I have a trigger in a table with a good number of columns (perhaps around 100) and quite a lot of updates (for some definition of "a lot of"). If any of some fields have changed, the trigger inserts some data in another table. For obvious reasons, I want this trigger to run as fast as possible. What's the best method to do the compariso...

Where does a Server trigger save in SQL Server ?

Hi , A couple of days ago , I was practicing and I wrote some triggers like these : create trigger trg_preventionDrop on all server for drop_database as print 'Can not Drop Database' rollback tran go create trigger trg_preventDeleteTable on database for drop_table as print 'you can not delete any table' rollback tran But the pr...

Error in my trigger

Hello everyone. I am working on a project using SqlSiteMapProvider. I have two tables Articles and SiteMap Articles table: CREATE TABLE [dbuser].[Articles]( [ArticleId] [uniqueidentifier] NOT NULL, [Title] [nvarchar](500) NULL, [Description] [ntext] NULL, [CategoryId] [int] NULL, [pubDate] [datetime] NULL, [Author] [nvarchar](25...

Simple trigger in SQL Server 2008

Hi. Can anybody tell me how can I update a column of a record when it is inserted to the database. Here's the pseudocode that I want. if( mytable.OriginalId == null ) mytable.OriginalId = Scope_Identity(); ...

WPF TextBox setting Text using Trigger during validation

I am having a requirement where in I have to revert the values of a TextBox to old value when the user enters a wrong input. I am using MVVM framework so I dont want to write any codebehind. The Text and Tag of TextBox is databound from ViewModel variable. So my Tag field of TextBox will always have old value. I want to use the Tag field...

Create trigger in PhpMyadmin?

I am using two tables. User table contains the firstname and lastname field and contactinfo is another table contain the field called 'Name' with usertable Id.I want to make a trigger whenever the User tables firstname or lastname is updated I want change this contactinfo's Name to whatever they changed in the User table.Is it possibl...

asynchronus triggers

Greetings I need to know what is the meaning of asynchronoous trigger and is there difference between asynchronus triggers and the normal triggers that is used in sql-server after or before inserting ,updating,deleting thnx ...

How do I trigger a WPF expander IsExpanded property from another expander's IsExpanded property

I have two expanders, side by side. I want only one to be expanded at a time. So if one is expanded, and the user expands the other, I want the first one to collapse. The user can have both collapsed, and both collapsed is the starting state. As can be seen in the code, I have included the "Header" property as a test, and it works as...

EventTrigger with Setter in WPF?

I have a normal Button and TextBox in a WPF-Window and I want a Template for the Button with a EventTrigger that listens to Button.Click and then sets a boolean-property of the TextBox. No code-behind. Something like this: <ControlTemplate.Triggers> <EventTrigger SourceName="MyButton" RoutedEvent="Button.Click"> <Setter TargetNam...

Can I have a materialized view refresh on commit only for two of three tables in its select statement?

I would like to use a materialized view that refreshes ON COMMIT. My backing view joins two tables in the local database and one table in a remote database via DB Link. How can I have the view refresh only when changes are made to one of the two local tables? Are there any other ways to solve this problem? Can I have the materialized...

Trigger for FTP files

Hi, At this moment I have an application that processes a file. My workflow is: Someone puts a file in a FTP and notifies me I download the file and run my app with that file. It returns a proccessed file. I put the result in the FTP again and notify my workmate. Is there any kind of trigger that executes my code when someone drops ...

SQL Server Cascading

I am making a website where users can post 'Posts' and then users can 'Comment' on these posts. I have a database with 3 tables. One contains User Information, one contains Post Information and the final one contains Comment Information. I want to set up rules so that if a User is deleted, all of their posts and comments are deleted, an...

How to create a trigger to record changes for Insert,Update,Delete for multiple tables.

I have two tables in my Database.This can increase later on.I want to add another table Audit to track changes to the existing two tables.I want to track any change done to any of these table AUdit Table structure is ID Table_Name Field_Name Old_Value New_Value Modified_By Date_of_Modification SO now I want to have one trigger for bot...

How to call a procedure or fire a trigger when a new connection is established in SQL Server 2008

Hi i want to call a stored procedure or fire a trigger when a new connection is established in SQL Server 2008. Thanks ...

How to Obtain Domain User Name when connecting via SQL Authentication

I have an application which connects to SQL Server 2000 (using a generic SQL Login and SQL Authentication). I would like to implement some logging via triggers to track data changes. I can't use USER_NAME() because that returns the generic account. I've poked through master..sysprocesses and it doesn't seem to record the username (alt...

Do triggers maintain atomicity even if the application crashes

I have a situation where I have 2 tables in which I can do Insert,Update,Delete.I'm introducing a table audit_trail to maintain a log of changes of this two tables.Now to enter values in audit_trail table I have written insert statements after any Update,Delete or Insert on either of the table.Now if an modification happened on one of th...

Trigger Events using Jquery

I want to mimic some of the Events like Ctrl+D or Ctrl+S Here's a piece of code that I found on StackOverflow but this also is not working var evt = jQuery.Event("keypress"); evt.keyCode = 100; // d evt.ctrlKey = true; $(document).trigger(evt); ...

Mysql create trigger 1064 error

The sql i wrote **delimiter | CREATE DEFINER=CURRENT_USER TRIGGER set_profiletype_after_insert BEFORE INSERT ON trl_translator FOR EACH ROW BEGIN UPDATE trl_profile SET trl_profile.type = 'translator' WHERE trl_profile.profile_id = NEW.translator_id END | delimiter ;** The error given [SQL] **CREATE DEFINER=CURRENT_USER TRIGG...