Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 diferences between sql server 2005 and 2008 when i

Author  Topic 

isnogood
Starting Member

2 Posts

Posted - 2009-11-05 : 03:56:39
The situation is this: I am making system for synchronizing databases between separate locations. So I created program that creates triggers for update and delete operations on those tables that are defined to be subject of synchronization. The inserts are taken care of with timestamp.
this works perfectly with SQL Server 2008, however users of our ERP system also use SQL Server 2000 and SQL Server 2005. So I tested my system in those environments also, and to my surprise, I found out that updating a primary key or a part of the primary key with the same value, triggers my triggers on tables that have this key as their foreign key. This does not happen in SQL Server 2008.
Just in case I did not made myself clear
Say table1 has a primary key pk1 and Table2 has pk2 but also fk1 which references the pk1 from t1. Both have triggers on update and on delete
If I write update table1 set pk1='123' where pk1='123'
in sql server 2008 I only get (1 row(s) affected)
in sql server 2005 I get :


(3194 row(s) affected)

(1 row(s) affected)

where 3194 was a number of rows in table2 that had 123 as its foreign key.

Does anybody knows why this happens this way?

I should have been a bus driver.
   

- Advertisement -