CREATE TABLE [dbo].[DocumentType]
(
[DocumentTypeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentGroupFID] [int] NOT NULL,
[Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[IsWorkTicket] [bit] NOT NULL CONSTRAINT [DF_DocumentType_IsWorkTicket] DEFAULT ((0)),
[Inactive] [bit] NOT NULL CONSTRAINT [DF_DocumentType_Inactive] DEFAULT ((0)),
[ShowInMsCrew] [bit] NOT NULL CONSTRAINT [DF_DocumentType_ShowInMsCrew] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentType] ADD CONSTRAINT [PK_DocumentType] PRIMARY KEY CLUSTERED ([DocumentTypeID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentType] ADD CONSTRAINT [IX_DocumentType_Type] UNIQUE NONCLUSTERED ([Type]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentType] ADD CONSTRAINT [FK_DocumentType_DocumentGroup] FOREIGN KEY ([DocumentGroupFID]) REFERENCES [dbo].[DocumentGroup] ([DocumentGroupID])
GO
GRANT SELECT ON [dbo].[DocumentType] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentType] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentType] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentType] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'The description of the document type.', 'SCHEMA', N'dbo', 'TABLE', N'DocumentType', 'COLUMN', N'Description'
GO
EXEC sp_addextendedproperty N'MS_Description', N'A foreign key to a document group.', 'SCHEMA', N'dbo', 'TABLE', N'DocumentType', 'COLUMN', N'DocumentGroupFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The primary key.', 'SCHEMA', N'dbo', 'TABLE', N'DocumentType', 'COLUMN', N'DocumentTypeID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'A flag indicating whether this document type uses work ticket numbers.', 'SCHEMA', N'dbo', 'TABLE', N'DocumentType', 'COLUMN', N'IsWorkTicket'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The short type code describing the document type.', 'SCHEMA', N'dbo', 'TABLE', N'DocumentType', 'COLUMN', N'Type'
GO