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.
| Author |
Topic |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-08-31 : 13:20:49
|
| Is there any way to identify using a trigger which field got updated.say I have a table with columnsemp_id,emp_name,emp_ageNow the updation has happend to the emp_age.Is there any way I can know that only emp_age is updated |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-08-31 : 13:27:50
|
| There is a condition I need to check if the emp_age is updated.So will I able to capture to which field the updation happend |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-31 : 13:43:18
|
| If you look at CREATE TRIGGER in SQL Server Books Online, it shows examples of how to check if a column has been updated. It's tricky.Tara |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-31 : 13:49:43
|
| doesn't IF UPDATE (columnName) in trigger do what he wants?Go with the flow & have fun! Else fight the flow :) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-31 : 13:52:04
|
| I should have said could be tricky if you need to check more than one column.Tara |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-31 : 13:56:55
|
| emm... so what does IF (COLUMNS_UPDATED()) do then?and what's stopping him from using IF UPDATE (columnName) more than once?Go with the flow & have fun! Else fight the flow :) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-08-31 : 13:59:11
|
| It's for multiple columns. I'm just saying it could be tricky for someone not familiar with it.Tara |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-08-31 : 14:26:42
|
| got it with the if update(column name)....Thanks tduggan and spirit1 |
 |
|
|
|
|
|