very well SQL server. I hope someone can help me with the folling: I
need to know if it is possible to implement a trigger that monitors
the value of an specific field, and when it changes the value from 0
to 1 it should update the value of another field in another table but
after some arithmetic operations. The arithmetics operations involves
data within the same database.
Is this can be made using triggers and stored procedures?Of course it can!
Look for this key words in SQL BOL: triggers, after, 'if update', inserted tables, deleted tables.
--
Dean Savovic
www.teched.hr
"Alejandro" <alejandro_ceja@.yahoo.com.mx> wrote in message news:85729932.0311041500.64581e86@.posting.google.c om...
> Hi! I have no experience at all using triggers, and I don't even know
> very well SQL server. I hope someone can help me with the folling: I
> need to know if it is possible to implement a trigger that monitors
> the value of an specific field, and when it changes the value from 0
> to 1 it should update the value of another field in another table but
> after some arithmetic operations. The arithmetics operations involves
> data within the same database.
> Is this can be made using triggers and stored procedures?|||Yes it can.
Personally Id recommend against it as I believe triggers to be the
very personal work of satan.
They can be quite slow - specially on heavy load tables, and have a
bad habit of hiding away and getting lost when you move the
database...
But yes - sure you can do that.
alejandro_ceja@.yahoo.com.mx (Alejandro) wrote in message news:<85729932.0311041500.64581e86@.posting.google.com>...
> Is this can be made using triggers and stored procedures?|||Hi
SQL server does not have the ability to create a trigger on an
individual column
but you can check that a column has changed within a trigger but
either comparing the values for that column in the inserted and
deleted or possibly the COLUMNS_UPDATED clause (Although a column can
be updated it may not be to a different value!).
See the "CREATE TRIGGER" topic in Books Online or at:
http://msdn.microsoft.com/library/d...reate2_7eeq.asp
The examples given in this topic also who how to update other tables.
HTH
John
alejandro_ceja@.yahoo.com.mx (Alejandro) wrote in message news:<85729932.0311041500.64581e86@.posting.google.com>...
> Hi! I have no experience at all using triggers, and I don't even know
> very well SQL server. I hope someone can help me with the folling: I
> need to know if it is possible to implement a trigger that monitors
> the value of an specific field, and when it changes the value from 0
> to 1 it should update the value of another field in another table but
> after some arithmetic operations. The arithmetics operations involves
> data within the same database.
> Is this can be made using triggers and stored procedures?
No comments:
Post a Comment