triggers

triggering functions with facebook connect

I'm trying to do what is supposed to be fairly simple with facebook connect, but having no luck. When a user logs in, I want to show that users details (refreshed without reloading the page), and when the user logs out, I need to go back to a logged in state. The code I have is function update_user_box(){ jQuery('span#logge...

Trigger to update data on another sql server

Hello, I'm using two SQL Server, one is SQL Server 2000 and the other one is SQL Server 2005. When the table1 in SQL Server 2000 gets updated/inserted/deleted, I have to update another table in SQL Server 2005. Is it possible to achieve that in a trigger? If not, what would be the possible options? Thank you, have a nice day! ...

Propagated delete in code or database?

I'm working on an iPhone application with a few data relationships (Author -> Books for example). When a user deletes an Author object from the application, I have a few SQLite triggers that run on the delete to remove any books from the database that have a foreign key matching the Author's primary key. I'm also using a trigger to i...

Introduction to SQL triggers?

I am a student, with decent knowledge of SQL, but have had very little to do with triggers in the past. I've looked at a few sites for guidance, but comprehensive explanation on all commonly used statements seems fairly sparse. Is there a 'definitive' site for this kind of thing? Perhaps like a w3chools for advanced SQL? ...

WPF - How to combine DataTrigger and Trigger?

NOTE I have asked the related question: How to combine DataTrigger and EventTrigger? I have a list box containing several items. The item's class implements INotifyPropertyChanged and has a property IsAvailable. I use that property to indicate unavailable options in the list using a different colour. However, if a selected item i...

Audit each inserted row in a Trigger

I am trying to do an audit history by adding triggers to my tables and inserting rows intto my Audit table. I have a stored procedure that makes doing the inserts a bit easier because it saves code; I don't have to write out the entire insert statement, but I instead execute the stored procedure with a few parameters of the columns I wan...

Determine Old primary key in a SQL Trigger

I've done this before somewhere I'm sure of it! I have a SQL Server 2000 table that I need to log changes to fields on updates and inserts into a second Logging table. A simplified version of the structure I'm using is below: MainTable ID varchar(10) PRIMARY KEY DESCRIPTION varchar(50) LogTable OLDID varchar(10) NEWID varchar(10) Fo...

SQL Server 2000 Odd Insert Trigger Behavior -- Recursive Like

Hello, I have a trigger in a table in SQL Server 2000, this is the trigger: ALTER Trigger [dbo].[Set_Asignado_State] ON [dbo].[Tables] FOR INSERT AS BEGIN DECLARE @area varchar(1) SELECT @area = Table_Area_ID FROM inserted IF (@area = 'L') BEGIN INSERT INTO Table_History SELECT (SELECT TOP 1 Table_Are...

"Punish" developers or fix it up automatically? Trigger vs constraint

Let's say I have a database column that should always be in uppercase. Here are a couple of ideas: 1) Create a column constraint of: col = UPPER(col) 2) Create an before insert/update row trigger that sets: col = UPPER(col) Usually the more constraints on your database data the better, and triggers can be mysterious and bad. Assume ...

WPF Triggers: Changing an out-of-scope control's style in a trigger

I can't come up with a solution for this problem in XAML: I want to animate the width of the right button to a certain value when IsMouseOver of the left button is true. I dont know where to put this: in a style or template of one of the buttons or in a style on the grid. Is it even possible? <Border Style="{StaticResource ContentBodyS...

What is the best way to check whether a trigger exists in SQL Server?

I'm looking for the most portable method to check for existance of a trigger in MS SQL Server. It needs to work on at least SQL Server 2000, 2005 and preferably 2008. The information does not appear to be in INFORMATION_SCHEMA, but if it is in there somewhere, I would prefer to use it from there. I do know of this method: if exists ( ...

How can I do a BEFORE UPDATED trigger with sql server?

I'm using Sqlserver express and I can't do before updated trigger. There's a other way to do that? ...

SQL Server Triggers - grouping by transactions

At work we have just started building an auditing framework for our database (i.e. to log what data has changed when it is created or updated). We'd quite like to implement this using triggers as data sometimes gets imported into the system from other places, not just via the front-end. This seems to be a fairly common solution. Howeve...

Handling multiple records in a MS SQL trigger

Hello Stack Overflow! I am having to use triggers in MSSQL for the first time, well triggers in general. Having read around and tested this myself I realise now that a trigger fires per command and not per row inserted, deleted or updated. The entire thing is some statistics for an advertising system. Our main stat table is rather larg...

Which SQL statement can I use to re-execute the trigger and update all the rows in a table?

I have a table with a lot of rows and I have changed the function associated with the trigger in insert or update events. This function makes calculations to update columns with conditional logic according to the values in two or more cells, so an single update statement would not be useful. So, which SQL statement can I use to re-execu...

Notifying app from SqlServer

Given a typical 3 tiers app deployed at two remote sites. The db behind the two installations contains exactly the same structure and same data. There needs to be a replication mechanism between the two backend db to keep them in synch. The native replication feature of SqlServer would do the job. However, the business layer of the app k...

WPF - Best way of responding to changes in a ViewModel at Page/Window level

I'm developing an XBAP and i have a simple requirement. The DataContext of the whole main page is set to an instance of my UserViewModel. The UserViewModel has a DependencyProperty called AuthenticationState which is an enum with values like 'Authenticated','NotAutheticated' and 'AuthenticationFailed'. Now, i need to respond to an...

How to find a text inside SQL Server procedures / triggers?

I have a linkedserver that will change. Some procedures call the linked server like this: "[10.10.100.50].dbo.SPROCEDURE_EXAMPLE". We have triggers also doing this kind of work. We need to find all places that uses "[10.10.100.50]" to change it. In SQL Server Management Studio Express I didn't find this feature, a "find in whole databas...

To check values in other databases using trigger

Is it possible to check whether a particular value in a column exists in other databases using trigger? These two databases are located inside the same MYSQL instance. Specifically, what I want to do is this: Before a row is added to a table ( Document_Index_table) inside Database A ( Document_DB). A trigger is fired. This trigger car...

Get database name from DDL Trigger

I am creating a server level trigger in SQL 2008 to log table creation and drops. I need to log the database that the table was created in/dropped from. First I created a column with a default value of db_name(), but this always recorded master. Next I tried using this in my insert statement: EVENTDATA().value('(/EVENT_INSTANCE/Datab...