[dbo].[CrewSMSServiceDetailsSnapshot]
CREATE TABLE [dbo].[CrewSMSServiceDetailsSnapshot]
(
[CrewSMSServiceDetailsSnapshotID] [int] NOT NULL IDENTITY(1, 1),
[LocServFID] [int] NOT NULL,
[SysuserFID] [int] NOT NULL,
[ServiceDate] [datetime] NOT NULL,
[CrewReportTime] [datetime] NULL,
[CrewReportLocationFID] [int] NULL,
[LaborTypeFID] [int] NOT NULL,
[StartTime] [datetime] NULL,
[EndTime] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CrewSMSServiceDetailsSnapshot] ADD CONSTRAINT [PK_CrewSMSServiceDetailsSnapshot] PRIMARY KEY NONCLUSTERED ([CrewSMSServiceDetailsSnapshotID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CrewSMSServiceDetailsSnapshot_LocServFID] ON [dbo].[CrewSMSServiceDetailsSnapshot] ([LocServFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CrewSMSServiceDetailsSnapshot_LocServFID_SysuserFID] ON [dbo].[CrewSMSServiceDetailsSnapshot] ([LocServFID], [SysuserFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CrewSMSServiceDetailsSnapshot] ADD CONSTRAINT [FK_CrewSMSServiceDetailsSnapshot_LaborType] FOREIGN KEY ([LaborTypeFID]) REFERENCES [dbo].[LaborType] ([PriKey])
GO
ALTER TABLE [dbo].[CrewSMSServiceDetailsSnapshot] ADD CONSTRAINT [FK_CrewSMSServiceDetailsSnapshot_LocServ] FOREIGN KEY ([LocServFID]) REFERENCES [dbo].[LocServ] ([PriKey])
GO
ALTER TABLE [dbo].[CrewSMSServiceDetailsSnapshot] ADD CONSTRAINT [FK_CrewSMSServiceDetailsSnapshot_Sysuser] FOREIGN KEY ([SysuserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[CrewSMSServiceDetailsSnapshot] TO [MssExec]
GRANT INSERT ON [dbo].[CrewSMSServiceDetailsSnapshot] TO [MssExec]
GRANT DELETE ON [dbo].[CrewSMSServiceDetailsSnapshot] TO [MssExec]
GRANT UPDATE ON [dbo].[CrewSMSServiceDetailsSnapshot] TO [MssExec]
GO