[dba-SQLServer] triggers question

Francisco Tapia fhtapia at gmail.com
Thu Sep 16 01:10:14 CDT 2004


check out books on line, when checking columns you can script it if a
column changed something like:

IF UPDATE ( column ) 
    BEGIN
             UPDATE newtable 
                      SET column = column
              WHERE criteria = criteria

    END



On Tue, 14 Sep 2004 17:14:50 -0500, Julian Felipe Castrillon Trejos
<jfk at puj.edu.co> wrote:
> 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
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 



-- 
-Francisco
"Rediscover the web"
http://www.mozilla.org/products/firefox/
ttp://spreadfirefox.com/community/?q=affiliates&id=792&t=86



More information about the dba-SQLServer mailing list