[dbo].[AccountProfileOrderPrimaryContact]
This table stores information on which contact is considered a primary contact under a national account profile for an order record
CREATE TABLE [dbo].[AccountProfileOrderPrimaryContact]
(
[AccountProfileOrderPrimaryContactID] [int] NOT NULL IDENTITY(1, 1),
[AccountProfileContactFID] [int] NOT NULL,
[OrderFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileOrderPrimaryContact] ADD CONSTRAINT [PK_AccountProfileOrderPrimaryContact] PRIMARY KEY NONCLUSTERED ([AccountProfileOrderPrimaryContactID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileOrderPrimaryContact] ADD CONSTRAINT [ix_AccountProfileOrderPrimaryContact_Orders] UNIQUE NONCLUSTERED ([OrderFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileOrderPrimaryContact] ADD CONSTRAINT [FK_AccountProfileOrderPrimaryContact_AccountProfileContacts] FOREIGN KEY ([AccountProfileContactFID]) REFERENCES [dbo].[AccountProfileContacts] ([AccountProfileContactID])
GO
ALTER TABLE [dbo].[AccountProfileOrderPrimaryContact] ADD CONSTRAINT [FK_AccountProfileOrderPrimaryContact_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[AccountProfileOrderPrimaryContact] TO [MssExec]
GRANT INSERT ON [dbo].[AccountProfileOrderPrimaryContact] TO [MssExec]
GRANT DELETE ON [dbo].[AccountProfileOrderPrimaryContact] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountProfileOrderPrimaryContact] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'This table stores information on which contact is considered a primary contact under a national account profile for an order record', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileOrderPrimaryContact', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a national account contact', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileOrderPrimaryContact', 'COLUMN', N'AccountProfileContactFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key of this table', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileOrderPrimaryContact', 'COLUMN', N'AccountProfileOrderPrimaryContactID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to an order record', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileOrderPrimaryContact', 'COLUMN', N'OrderFID'
GO