[dbo].[AccountProfileContactPhoneNumber]
This table stores the phone numbers of contacts for a national account
CREATE TABLE [dbo].[AccountProfileContactPhoneNumber]
(
[AccountProfileContactPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[AccountProfileContactFID] [int] NOT NULL,
[AccountProfileContactPhoneTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileContactPhoneNumber] ADD CONSTRAINT [PK_AccountProfileContactPhoneNumber] PRIMARY KEY NONCLUSTERED ([AccountProfileContactPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileContactPhoneNumber] ADD CONSTRAINT [IX_AccountProfileContactPhoneNumber_AccountProfileContactAndPhoneType] UNIQUE NONCLUSTERED ([AccountProfileContactFID], [AccountProfileContactPhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileContactPhoneNumber] ADD CONSTRAINT [FK_AccountProfileContactPhoneNumber_AccountProfileContact] FOREIGN KEY ([AccountProfileContactFID]) REFERENCES [dbo].[AccountProfileContacts] ([AccountProfileContactID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountProfileContactPhoneNumber] ADD CONSTRAINT [FK_AccountProfileContactPhoneNumber_AccountProfileContactPhoneType] FOREIGN KEY ([AccountProfileContactPhoneTypeFID]) REFERENCES [dbo].[AccountProfileContactPhoneType] ([AccountProfileContactPhoneTypeID])
GO
ALTER TABLE [dbo].[AccountProfileContactPhoneNumber] ADD CONSTRAINT [FK_AccountProfileContactPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
GRANT SELECT ON [dbo].[AccountProfileContactPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[AccountProfileContactPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[AccountProfileContactPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountProfileContactPhoneNumber] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'This table stores the phone numbers of contacts for a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a national account contact record', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'AccountProfileContactFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key of this table', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'AccountProfileContactPhoneNumberID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key associating a record to a contact phone type', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'AccountProfileContactPhoneTypeFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The area code of the phone number for a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'AreaCode'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key associating a record to a country code', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'CountryCodeStandardFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The phone number extension for a contact within a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'Extension'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The local phone number for a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileContactPhoneNumber', 'COLUMN', N'LocalNumber'
GO