Skip to content

Instantly share code, notes, and snippets.

@mivano
Last active August 29, 2015 13:58
Show Gist options
  • Save mivano/10429656 to your computer and use it in GitHub Desktop.
Save mivano/10429656 to your computer and use it in GitHub Desktop.
Serilog Log table create SQL
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Logs](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Message] [nvarchar](max) NULL,
[MessageTemplate] [nvarchar](max) NULL,
[Level] [nvarchar](128) NULL,
[TimeStamp] [datetime] NOT NULL,
[Exception] [nvarchar](max) NULL,
[Properties] [xml] NULL,
CONSTRAINT [PK_Logs] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
@lotsahelp
Copy link

Setting TimeStamp to datetime2 would enable a more accurate time and is more future proof than datetime. Depending on the accuracy, you could save 1-2 bytes per row.

@rvlieshout
Copy link

Should you assume the [dbo] schema?!

@mivano
Copy link
Author

mivano commented Dec 16, 2014

@rvlieshout, you are right; I removed the [dbo]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment