Re: lastmodified
From: Andrew J. Kelly (sqlmvpnooospam_at_shadhawk.com)
Date: 02/22/05
- Next message: Matt Tapia: "sql agent service"
- Previous message: Gary: "Re: SQL Server login with hostname masking"
- In reply to: Jason: "lastmodified"
- Next in thread: Uri Dimant: "Re: lastmodified"
- Reply: Uri Dimant: "Re: lastmodified"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 22 Feb 2005 15:54:02 -0500
CREATE TRIGGER tr_YourTrigger
ON YourTable
FOR UPDATE
AS
IF @@ROWCOUNT > 0
UPDATE YourTable SET [LastModified] = GETDATE()
WHERE YourPK IN (SELECT b.PK FROM Inserted AS b)
-- Andrew J. Kelly SQL MVP "Jason" <jlewis@hotmail.com> wrote in message news:O$XaerRGFHA.2568@TK2MSFTNGP10.phx.gbl... > Hi, > > Can someone provide me a simple trigger where it updates a lastmodified > column. > > It should update the column lastmodified whenever an update occurs on all > the other columns. > > Thnx >
- Next message: Matt Tapia: "sql agent service"
- Previous message: Gary: "Re: SQL Server login with hostname masking"
- In reply to: Jason: "lastmodified"
- Next in thread: Uri Dimant: "Re: lastmodified"
- Reply: Uri Dimant: "Re: lastmodified"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|