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 |
|
stroek
Starting Member
18 Posts |
Posted - 2008-12-16 : 05:51:39
|
| Hello,How can I create a field that updates every time the record has bin updatedRegards |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-16 : 06:00:06
|
You can use a trigger to update the column for you.Your best bet is probably an "INSTEAD OF" trigger. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
stroek
Starting Member
18 Posts |
Posted - 2008-12-16 : 06:14:26
|
| Tks,When I use the next trigger.It updates every recordALTER TRIGGER tr_Triooo_SM_ContactStructure on Triooo_SM_ContactStructure FOR UPDATE AS IF UPDATE(item) BEGIN update Triooo_SM_ContactStructure set DateUpdate = GetDate() ENDGO |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-16 : 06:21:27
|
[code]ALTER TRIGGER tr_Triooo_SM_ContactStructureON Triooo_SM_ContactStructureAFTER UPDATEASIF UPDATE(item) UPDATE x SET x.DateUpdate = GetDate() FROM Triooo_SM_ContactStructure AS x INNER JOIN inserted as i on i.pkcol = x.pkcol[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|