events.sql 497 B

1234567891011121314151617181920212223
  1. CREATE TABLE [dbo].[Events] (
  2. [EventID] [int] IDENTITY (1, 1) NOT NULL ,
  3. [Event] [int] NOT NULL ,
  4. [DateTime] [datetime] NULL ,
  5. [ComputerName] [varchar] (15) NOT NULL ,
  6. [Subject] [int] NOT NULL ,
  7. [SubjectName] [varchar] (32) NOT NULL ,
  8. [Context] [varchar] (24) NOT NULL ,
  9. [ObjectRef] [varchar] (4000) NOT NULL
  10. )
  11. GO
  12. CREATE Trigger EventDateTime
  13. On dbo.Events
  14. For Insert, Update
  15. As
  16. UPDATE Events Set DateTime=GetDate()
  17. WHERE Events.IDENTITYCOL IN (SELECT IDENTITYCOL FROM inserted)
  18. GO