[dbo].[AccountPhoneNumber]
This table stores the phone information associated to a national account
CREATE TABLE [dbo].[AccountPhoneNumber]
(
[AccountPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[AccountFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountPhoneNumber] ADD CONSTRAINT [PK_AccountPhoneNumber] PRIMARY KEY NONCLUSTERED ([AccountPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountPhoneNumber] ADD CONSTRAINT [IX_AccountPhoneNumber_Account] UNIQUE NONCLUSTERED ([AccountFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountPhoneNumber] ADD CONSTRAINT [FK_AccountPhoneNumber_Account] FOREIGN KEY ([AccountFID]) REFERENCES [dbo].[Accounts] ([AccountPriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountPhoneNumber] ADD CONSTRAINT [FK_AccountPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
GRANT SELECT ON [dbo].[AccountPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[AccountPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[AccountPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountPhoneNumber] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'This table stores the phone information associated to a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a national account record', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'AccountFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key of this table', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'AccountPhoneNumberID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The area code of the phone number for a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'AreaCode'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key associating a record to a country code', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'CountryCodeStandardFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The phone number extension for a contact at the national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'Extension'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The local phone number for a national account', 'SCHEMA', N'dbo', 'TABLE', N'AccountPhoneNumber', 'COLUMN', N'LocalNumber'
GO