Sql Log Data Structure

To create the Web Application Log table use code like the following:

CREATE TABLE [dbo].[ApplicationWebLog](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Entered] [datetime] NOT NULL,
	[Message] [nvarchar](255) NULL,
	[ErrorLevel] [int] NOT NULL,
	[Details] [nvarchar](2048) NULL,
	[Url] [nvarchar](255) NULL,
	[QueryString] [nvarchar](255) NULL,
	[IpAddress] [nvarchar](20) NULL,
	[Referrer] [nvarchar](255) NULL,
	[UserAgent] [nvarchar](255) NULL,
	[PostData] [nvarchar](2048) NULL,
	[RequestDuration] [decimal](9, 3) NOT NULL
) ON [PRIMARY]

ALTER TABLE [dbo].[ApplicationWebLog] ADD  CONSTRAINT [DF_ApplicationWebLog_Entered]  DEFAULT (getdate()) FOR [Entered]
ALTER TABLE [dbo].[ApplicationWebLog] ADD  CONSTRAINT [DF_ApplicationWebLog_ErrorLevel]  DEFAULT ((0)) FOR [ErrorLevel]
ALTER TABLE [dbo].[ApplicationWebLog] ADD  CONSTRAINT [DF_ApplicationWebLog_RequestDuration]  DEFAULT ((-1)) FOR [RequestDuration]

All updates to the database are done with dynamic SQL statements inserting data.


© West Wind Technologies, 1996-2016 • Updated: 12/19/15
Comment or report problem with topic