CREATE TABLE [dbo].[ETLBatchPool](
[BatchID] [bigint] IDENTITY(1,1) NOT NULL,
[BatchStatus] [tinyint] NULL,
[Generator] [nvarchar](100) NULL,
[GenerateTime] [datetime] NULL,
[ProcessStartTime] [datetime] NULL,
[ProcessEndTime] [datetime] NULL,
InsertTime [datetime] NULL,
[UpdateTime] [datetime] NULL
[BatchID] [bigint] IDENTITY(1,1) NOT NULL,
[BatchStatus] [tinyint] NULL,
[Generator] [nvarchar](100) NULL,
[GenerateTime] [datetime] NULL,
[ProcessStartTime] [datetime] NULL,
[ProcessEndTime] [datetime] NULL,
InsertTime [datetime] NULL,
[UpdateTime] [datetime] NULL
) ON [PRIMARY]
CREATE procedure [dbo].[sp_ETLGenerateBatchID]
@User nvarchar(100) = NULL,
@BatchID int output
as
begin
if (@User is null)
set @User = ORIGINAL_LOGIN();
insert into ETLBatchPool(BatchStatus,Generator,GenerateTime,InsertTime,UpdateTime)
values(0,@User,GETDATE(),GETDATE(),GETDATE());
set @BatchID = SCOPE_IDENTITY();
end