Using DEFAULT option on Audit columns

Aug 6, 2010 at 3:25 PM
My Audit table is replicated via 3rd party software requiring a ROWGUIDCOL for the Audit.AuditID. So 4 v.1.10 I would recommend for the create Audit table: CREATE TABLE dbo.Audit ( [AuditID] [uniqueidentifier] NOT NULL ROWGUIDCOL DEFAULT (newid()) PRIMARY KEY CLUSTERED, [AuditDate] [datetime] NOT NULL DEFAULT (getutcdate()), [HostName] [sysname] NOT NULL, [SysUser] [varchar](50) NOT NULL, [Application] [varchar](50) NOT NULL, [TableName] [sysname] NOT NULL, [Operation] [varchar](20) NOT NULL, -- (Hard coded)Inserted,Updated,Deleted [PrimaryKey] [varchar](20) NOT NULL, -- edit to suite [RowDescription] [varchar](50) NULL,-- Optional [SecondaryRow] [varchar](50) NULL, -- Optional [ColumnName] [sysname] NULL, -- required for Inserted,Updated, and now Deleted (ver 1.07), should add check constraint [OldValue] [varchar](50) NULL, -- edit to suite (Nvarchar() ?, varchar(MAX) ? ) [NewValue] [varchar](50) NULL, -- edit to suite (Nvarchar() ?, varchar(MAX) ? ) [RowVersion] [int] NOT NULL CONSTRAINT [DF_Audit_RowVersion] DEFAULT ((1)) ) Does this de-optimzed for inserts?
Coordinator
Aug 9, 2010 at 6:43 PM

I’ve just posted a new version of AutoAudit and would appreciate any testing and feedback prior publishing it.

Many thanks,

-Paul

http://autoaudit.codeplex.com/releases/view/50198

From: jsh02nova [mailto:notifications@codeplex.com]
Sent: Sunday, August 08, 2010 8:27 PM
To: pauln@sqlserverbible.com
Subject: Using DEFAULT option on Audit columns [AutoAudit:222739]

From: jsh02nova

My Audit table is replicated via 3rd party software requiring a ROWGUIDCOL for the Audit.AuditID. So 4 v.1.10 I would recommend for the create Audit table: CREATE TABLE dbo.Audit ( [AuditID] [uniqueidentifier] NOT NULL ROWGUIDCOL DEFAULT (newid()) PRIMARY KEY CLUSTERED, [AuditDate] [datetime] NOT NULL DEFAULT (getutcdate()), [HostName] [sysname] NOT NULL, [SysUser] [varchar](50) NOT NULL, [Application] [varchar](50) NOT NULL, [TableName] [sysname] NOT NULL, [Operation] [varchar](20) NOT NULL, -- (Hard coded)Inserted,Updated,Deleted [PrimaryKey] [varchar](20) NOT NULL, -- edit to suite [RowDescription] [varchar](50) NULL,-- Optional [SecondaryRow] [varchar](50) NULL, -- Optional [ColumnName] [sysname] NULL, -- required for Inserted,Updated, and now Deleted (ver 1.07), should add check constraint [OldValue] [varchar](50) NULL, -- edit to suite (Nvarchar() ?, varchar(MAX) ? ) [NewValue] [varchar](50) NULL, -- edit to suite (Nvarchar() ?, varchar(MAX) ? ) [RowVersion] [int] NOT NULL CONSTRAINT [DF_Audit_RowVersion] DEFAULT ((1)) ) Does this de-optimzed for inserts?

Read the full discussion online.

To add a post to this discussion, reply to this email (AutoAudit@discussions.codeplex.com)

To start a new discussion for this project, email AutoAudit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com