Re: GetDate
From: Tom Moreau (tom_at_dont.spam.me.cips.ca)
Date: 03/30/04
- Next message: Tom Moreau: "Re: Indexing for a Dimensional Model"
- Previous message: Uri Dimant: "Re: Drop all the connections to the DataBase"
- In reply to: Mike Kruchten: "Re: GetDate"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Mar 2004 10:32:46 -0500
Actually, this functionality has been in place for over a decade in the form
of triggers:
create trigger triu_MyTable on MyTable after insert, update
as
if @@ROWCOUNT = 0 return
update MyTable
set
LastUpdateDateTime = getdate ()
where
PK in (select PK from inserted)
go
-- Tom --------------------------------------------------------------- Thomas A. Moreau, BSc, PhD, MCSE, MCDBA SQL Server MVP Columnist, SQL Server Professional Toronto, ON Canada www.pinnaclepublishing.com/sql "Mike Kruchten" <mkruchten@fsisolutions.com> wrote in message news:#0KV3omFEHA.1240@TK2MSFTNGP10.phx.gbl... Would be nice, wouldn't it. Sybase SQL Anywhere has this functionality. Maybe next year Yukon will have it. Mike Kruchten "Keith" <@.> wrote in message news:OyxRm0jFEHA.688@tk2msftngp13.phx.gbl... > I am using GetDate() as the default value on selected fields to record the > date/time that a record is inserted into my tables, however, is it possible > to use a similar procedure to automatically insert the date/time into a > field, but ONLY if the record is subject to an update - thus recording the > date/time a record was last updated. > > Thanks > >
- Next message: Tom Moreau: "Re: Indexing for a Dimensional Model"
- Previous message: Uri Dimant: "Re: Drop all the connections to the DataBase"
- In reply to: Mike Kruchten: "Re: GetDate"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|