CREATE TABLE [dbo].[ServeqTimes]
(
[PriKey] [int] NOT NULL IDENTITY(1, 1),
[SEqPriKey] [int] NOT NULL,
[StartTime] [datetime] NOT NULL,
[EndTime] [datetime] NOT NULL,
[OverTime] [bit] NOT NULL,
[ActualCreatedBy] [int] NULL,
[IsFromMobileApi] [bit] NOT NULL CONSTRAINT [DF_ServeqTimes_IsFromMobileApi] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServeqTimes] ADD CONSTRAINT [PK_ServeqTimes] PRIMARY KEY CLUSTERED ([PriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ServeqTimes_ActualCreatedBy] ON [dbo].[ServeqTimes] ([ActualCreatedBy]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ServeqTimes_SEqPriKey] ON [dbo].[ServeqTimes] ([SEqPriKey], [IsFromMobileApi]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServeqTimes] ADD CONSTRAINT [FK_ServeqTimes_Sysuser] FOREIGN KEY ([ActualCreatedBy]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
ALTER TABLE [dbo].[ServeqTimes] ADD CONSTRAINT [FK_ServeqTimes_Serveq] FOREIGN KEY ([SEqPriKey]) REFERENCES [dbo].[Serveq] ([PRIKEY])
GO
GRANT SELECT ON [dbo].[ServeqTimes] TO [MssExec]
GRANT INSERT ON [dbo].[ServeqTimes] TO [MssExec]
GRANT DELETE ON [dbo].[ServeqTimes] TO [MssExec]
GRANT UPDATE ON [dbo].[ServeqTimes] TO [MssExec]
GO