Monday, February 20, 2012

record updated datetime

hi friends,
i want to find the record updated datetime. if 1 record is updated in the
table, I want to find the datetime of the updation.
I can't insert a column with timestamp and then insert the data to find. is
there any back process that stores this information.
thanks
vanitha--No, if you have to keep track of these changes you have to implement
that on your own.
CREATE TABLE TracKTable
(
ActionOccured CHAR(1),
Tablename SYSNAME,
ModifiedDate datetime DEFAULT GETDATE(),
ModifiedUser varchar(100) DEFAULT SYSTEM_USER,
ModifiedHost varchar(100) DEFAULT HOST_NAME()
)
CREATE TRIGGER TRG_SomeTriggerOnATable ON SomeTable
FOR INSERT,UPDATE,DELETE
AS
BEGIN
DECLARE @.TriggerAction CHAR(1)
IF (SELECT COUNT(*) From INSERTED) > 0
IF (SELECT COUNT(*) From DELETED) > 0
SET @.TriggerAction = 'U'
ELSE SET @.TriggerAction = 'I'
ELSE SET @.TriggerAction = 'D'
INSERT INTO TrackTable
(ActionOccured,Tablename)
SELECT
@.TriggerAction,
'SomeTable'
END
HTH, Jens Suessmeyer.|||Vanitha
create update trigger which updates getdate() whenevercolumn is updated.Or
insert getdate() directly from the stored procedure.
--
Regards
R.D
--Knowledge gets doubled when shared
"vanitha" wrote:

> hi friends,
> i want to find the record updated datetime. if 1 record is updated in the
> table, I want to find the datetime of the updation.
> I can't insert a column with timestamp and then insert the data to find. i
s
> there any back process that stores this information.
> thanks
> vanitha
>
>|||no I can't insert or update the value inside the table. I also can't
implement triggers. I shd find if there is any back process that does this.
thanks
vanitha
"R.D" wrote:
> Vanitha
> create update trigger which updates getdate() whenevercolumn is updated.O
r
> insert getdate() directly from the stored procedure.
> --
> Regards
> R.D
> --Knowledge gets doubled when shared
>
> "vanitha" wrote:
>|||No, there isnt. You could use a log reader thrid party tool for that
like www.lumigent.de logexplorer
HTH, Jens Suessmeyer.

No comments:

Post a Comment