Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Table and insert stored procedure for NLog when using SQL Server as a target. See http://dougv.us/r6 for more info.
USE [mydatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NLogErrorLog] (
[ErrorId] INT IDENTITY (1, 1) NOT NULL,
[ErrorDatetime] DATETIME NOT NULL,
[ErrorSource] NVARCHAR (MAX) NOT NULL,
[ErrorLevel] NVARCHAR (10) NOT NULL,
[ErrorMessage] TEXT NOT NULL
);
CREATE PROCEDURE [dbo].[NLogErrorLogInsert]
@errordate DATETIME,
@source NVARCHAR(MAX),
@level NVARCHAR(10),
@message TEXT
AS
INSERT INTO NLogErrorLog (
ErrorDatetime,
ErrorSource,
ErrorLevel,
ErrorMessage
)
VALUES (
@errordate,
@source,
@level,
@message
)
RETURN 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.