CREATE TABLE [dbo].[OrderNoteHeader]
(
[OrderNoteHeaderID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[NoteTypeFID] [smallint] NOT NULL,
[Subject] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Invoices] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SendToMsCrew] [bit] NOT NULL CONSTRAINT [DF_OrderNoteHeader_SendToMsCrew] DEFAULT ((0))
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderNoteHeader] ADD CONSTRAINT [PK_OrderNoteHeader] PRIMARY KEY CLUSTERED ([OrderNoteHeaderID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OrderNoteDetail_OrderFID] ON [dbo].[OrderNoteHeader] ([OrderFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderNoteHeader] ADD CONSTRAINT [FK_OrderNoteHeader_NoteType] FOREIGN KEY ([NoteTypeFID]) REFERENCES [dbo].[NoteType] ([NoteTypeID])
GO
ALTER TABLE [dbo].[OrderNoteHeader] ADD CONSTRAINT [FK_OrderNoteHeader_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[OrderNoteHeader] TO [MssExec]
GRANT INSERT ON [dbo].[OrderNoteHeader] TO [MssExec]
GRANT DELETE ON [dbo].[OrderNoteHeader] TO [MssExec]
GRANT UPDATE ON [dbo].[OrderNoteHeader] TO [MssExec]
GO