AUDIT Stored Procedure script with drop and create.
USE [Work]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spu_insert_audit]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spu_insert_audit]
USE [Work]
GO
CREATE PROCEDURE [dbo].[spu_insert_audit]
@StartTime DATETIME, @VersionBuild INT, @UserName VARCHAR (100), @PackageName VARCHAR (100), @MachineName VARCHAR (100), @AuditId BIGINT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
--declare @my_auditId bigint
insert into Audit (
Status,
StartTime,
EndTime,
VersionBuild,
UserName,
PackageName,
MachineName
) values (
'Running',
@startTime,
NULL,
@VersionBuild,
@UserName,
@PackageName,
@MachineName
)
set @AuditId = @@identity
END
GO
AUDITTASK Stored Procedure script with drop and create.
USE [Work]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spu_insert_audit_task]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spu_insert_audit_task]
USE [Work]
GO
CREATE PROCEDURE [dbo].[spu_insert_audit_task]
@AuditId BIGINT, @StartTime DATETIME, @VersionBuild INT, @UserName VARCHAR (100), @PackageName VARCHAR (100), @MachineName VARCHAR (100), @TaskName VARCHAR (100), @TableName VARCHAR (100), @AuditTaskId BIGINT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
--declare @my_auditId bigint
insert into AuditTask (
Status,
AuditId,
StartTime,
EndTime,
VersionBuild,
UserName,
PackageName,
MachineName,
TaskName,
TableName
) values (
'Running',
@AuditId,
@startTime,
NULL,
@VersionBuild,
@UserName,
@PackageName,
@MachineName,
@TaskName,
@TableName
)
set @AuditTaskId = @@identity
END
GO
USE [Work]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spu_insert_audit]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spu_insert_audit]
USE [Work]
GO
CREATE PROCEDURE [dbo].[spu_insert_audit]
@StartTime DATETIME, @VersionBuild INT, @UserName VARCHAR (100), @PackageName VARCHAR (100), @MachineName VARCHAR (100), @AuditId BIGINT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
--declare @my_auditId bigint
insert into Audit (
Status,
StartTime,
EndTime,
VersionBuild,
UserName,
PackageName,
MachineName
) values (
'Running',
@startTime,
NULL,
@VersionBuild,
@UserName,
@PackageName,
@MachineName
)
set @AuditId = @@identity
END
GO
AUDITTASK Stored Procedure script with drop and create.
USE [Work]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spu_insert_audit_task]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spu_insert_audit_task]
USE [Work]
GO
CREATE PROCEDURE [dbo].[spu_insert_audit_task]
@AuditId BIGINT, @StartTime DATETIME, @VersionBuild INT, @UserName VARCHAR (100), @PackageName VARCHAR (100), @MachineName VARCHAR (100), @TaskName VARCHAR (100), @TableName VARCHAR (100), @AuditTaskId BIGINT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
--declare @my_auditId bigint
insert into AuditTask (
Status,
AuditId,
StartTime,
EndTime,
VersionBuild,
UserName,
PackageName,
MachineName,
TaskName,
TableName
) values (
'Running',
@AuditId,
@startTime,
NULL,
@VersionBuild,
@UserName,
@PackageName,
@MachineName,
@TaskName,
@TableName
)
set @AuditTaskId = @@identity
END
GO
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.