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 |
|
InNomina
Starting Member
40 Posts |
Posted - 2012-01-04 : 12:48:43
|
| Synopsis...I would like 2 columns in my record.Date Created< which is easy and I have this already>Date Modified< Which is my issue>I have users that access table information through a 3rd party product. When the table information is changed in any way I would a column called DATE MODIFIED to automatically change the date in that column to reflect the date any data in that particular record was changed.Your thoughts are greatly appreciated!Neil-------------------------"If you never fail, you're not trying hard enough" |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-04 : 12:53:05
|
you need to have a UPDATE trigger created in table for that. it will be like belowCREATE TRIGGER GetModifiedDateON tableAFTER UPDATEASBEGINUPDATE tSET t.[Date Modified]= GETDATE()FROM table tINNER JOIN INSERTED iON i.PK = t.PKEND PK will be primary key of your tableAlso make sure nested triggers setting is set to false in server------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|