[dba-SQLServer] triggers question

Julian Felipe Castrillon Trejos JFK at puj.edu.co
Tue Sep 14 17:14:50 CDT 2004


hello eveybody i have a question i hope you can help me answer
 
i'm working with SQL server 2000 and i'm making  an update trigger in a database.
 
the thing is, i have two tables and i want to be sure both of then have the same data, when the principal table is updated that update must be made in the secondary table but i have a problem, in the principal table there are several rows with the same value in the field to be updated so i don't really now witch particular rows was afected in order to make the update in the secondary table, here is an example
 
field1    field2   field3
1            x        4
2            y        4
3            z        4
4            w        4
5            u        4
6            c        4
 
both of the tables have the same data, when i change the value 4 from the principal table in the field3 in the first row (1   x   4) i want the update trigger to change the same row in the secundary table but how can i identify that row in the secondary table if the trigger only give me the value 4 and the new value for that field and all of the rows have the same 4 in the field3 so i don't know whitch of the rows was the one updated. i want to know if there is a way to ask the trigger for the number of the row affected or somethin like that or if there is a way extract the value from the field1 witch is unique and it could identify exactly one row.
 
thank you for your help
 
 
PD:sorry about the english.
 
--------------------------------------------- 
Julian Castrillon T 
Ingeniero de sistemas y computacion
Analista, IDA Ltda 
Ingenieria y desarrollo aplicados 
--------------------------------------------- 
Jesus save, but only Buda 
made incremental backups



More information about the dba-SQLServer mailing list