Microsoft Developer Network > Forums Home > Using Forums Forums > Where is the Forum For…? > diferences between sql server 2005 and 2008 when it comes to updating values
Ask a questionAsk a question
 

Answerdiferences between sql server 2005 and 2008 when it comes to updating values

  • Wednesday, November 04, 2009 1:29 PMkalifumestokalifa Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The situation is this I was 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.
    Is 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 nuber of rows in table2 that had 123 as its primary key.

    Does anybody knows why this happens this way?   

Answers

All Replies