База данных: Процедура журнализации ошибок стационарных терминалов

Регистрация хранимой процедуры

USE

[SteelTrace]

GO

/****** Object: StoredProcedure [dbo].[sp_Log] Script Date: 10/06/2010 13:10:27 ******/

SET

ANSI_NULLS ON

GO

SET

QUOTED_IDENTIFIER ON

GO

CREATE

PROCEDURE [dbo].[sp_Log](@DeviceId varchar(100), @LogXml nvarchar(max))

AS

BEGIN

DECLARE @UserAccountName nvarchar(50)

DECLARE @UserDomain nvarchar(256)

DECLARE @UserId nvarchar(68)

DECLARE @UserCommonName nvarchar(64)

SELECT TOP 1 @UserAccountName = UserAccountName,

@UserDomain

= UserDomain,

@UserId

= UserId,

@UserCommonName

= UserCommonName

FROM MDMS_User

INSERT INTO MDMS_DeviceLog (Category, [Created], [UserAccountName], [UserDomain], [DeviceId], [Data], [LogId], [UserId], [UserCommonName])

VALUES ('ErrorLogEntry', GETDATE(), @UserAccountName, @UserDomain, @DeviceId, @LogXml, NEWID(), @UserId, @UserCommonName)

SELECT @@ERROR FOR XML PATH, TYPE, ELEMENTS

END

GO

-- Регистрация записи в таблице мапирования запросов

INSERT

[dbo].[MDMS_QueryType] ([QueryTypeId], [Name], [Description], [QueryHandlerName], [FunctionName], [LogEnabled], [PeriodValidity]) VALUES (14, N'Log', N' ', N'SQL', N'dbo.sp_Log', 1, 0)

 

powered by metaPost


print

rating
  Комментарии