[dbo].[OrderContactPhoneNumber]
CREATE TABLE [dbo].[OrderContactPhoneNumber]
(
[OrderContactPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[OrderContactFID] [int] NOT NULL,
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[OrderContactPhoneTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderContactPhoneNumber] ADD CONSTRAINT [PK_OrderContactPhoneNumber] PRIMARY KEY NONCLUSTERED ([OrderContactPhoneNumberID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderContactPhoneNumber] ADD CONSTRAINT [IX_OrderContactPhoneNumber_OrderContactAndPhoneType] UNIQUE NONCLUSTERED ([OrderContactFID], [OrderContactPhoneTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OrderContactPhoneNumber] ADD CONSTRAINT [FK_OrderContactPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[OrderContactPhoneNumber] ADD CONSTRAINT [FK_OrderContactPhoneNumber_OrderContact] FOREIGN KEY ([OrderContactFID]) REFERENCES [dbo].[OrderContacts] ([OrderContactID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OrderContactPhoneNumber] ADD CONSTRAINT [FK_OrderContactPhoneNumber_OrderContactPhoneType] FOREIGN KEY ([OrderContactPhoneTypeFID]) REFERENCES [dbo].[OrderContactPhoneType] ([OrderContactPhoneTypeID])
GO
GRANT SELECT ON [dbo].[OrderContactPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[OrderContactPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[OrderContactPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[OrderContactPhoneNumber] TO [MssExec]
GO