CREATE TABLE [dbo].[GLDetail]
(
[GLDPriKey] [int] NOT NULL IDENTITY(1, 1),
[GLCPriKey] [int] NOT NULL,
[GLSPriKey] [int] NOT NULL,
[SegmentNumber] [int] NOT NULL,
[SegmentLength] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GLDetail] ADD CONSTRAINT [PK_GLDetail] PRIMARY KEY CLUSTERED ([GLDPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_GLDetail_GLCPriKey] ON [dbo].[GLDetail] ([GLCPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_GLDetail_GLSPriKey] ON [dbo].[GLDetail] ([GLSPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_GLDetail_SegmentNumber] ON [dbo].[GLDetail] ([SegmentNumber]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GLDetail] ADD CONSTRAINT [FK_GLDetail_GLControl] FOREIGN KEY ([GLCPriKey]) REFERENCES [dbo].[GLControl] ([GLCPriKey])
GO
ALTER TABLE [dbo].[GLDetail] ADD CONSTRAINT [FK_GLDetail_GLSource] FOREIGN KEY ([GLSPriKey]) REFERENCES [dbo].[GLSource] ([GLSPriKey])
GO
GRANT SELECT ON [dbo].[GLDetail] TO [MssExec]
GRANT INSERT ON [dbo].[GLDetail] TO [MssExec]
GRANT DELETE ON [dbo].[GLDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[GLDetail] TO [MssExec]
GO