Code Coverage by Clover.NET

SQL Data Table Qusetion

View: New views
2 Messages — Rating Filter:   Alert me  

SQL Data Table Qusetion

by Cyndenos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Does anyone know what the columns and types should be in order for Nlog to be able to write to the database.   I am using SQL Server 2005.   Is there a SQL Table Create Script somewhere that I can use to create my table for the database target?

Re: SQL Data Table Qusetion

by Jamison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's what I'm using. The table will support multiple applications. Columns are ordered by their likeliness to be searched on. Any critiques are welcome.


Create table [dbo].[Log]
(
        [LogID] Bigint Identity NOT NULL,
        [AppName] Varchar(50) NOT NULL,
        [AppFilter] Varchar(100) NOT NULL,
        [LogDate] Datetime NOT NULL,
        [Message] Nvarchar(255) NOT NULL,
        [Level] Varchar(5) NOT NULL,
        [Priority] Tinyint NOT NULL,
        [UserName] Varchar(100) NOT NULL,
        [UserIP] Varchar(39) NOT NULL,
        [MachineIP] Varchar(39) NOT NULL,
        [LogEntered] Datetime Constraint [DF_Log_LogEntered] Default GetUtcDate() NOT NULL,
        [LogGuid] Uniqueidentifier Constraint [DF_Log_LogGuid] Default NewID() NOT NULL, Constraint [UNQ_Log_LogGuid] UNIQUE ([LogGuid]),
        [Details] Ntext NOT NULL,
        [SerializedObject] xml NOT NULL,
Primary Key ([LogID])
)