CREATE TABLE [dbo].[JobPhoneNumber]
(
[JobPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[JobPhoneTypeFID] [int] NOT NULL,
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[JobsFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[JobPhoneNumber] ADD CONSTRAINT [PK_JobPhoneNumber] PRIMARY KEY NONCLUSTERED ([JobPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[JobPhoneNumber] ADD CONSTRAINT [IX_JobPhoneNumber_Job] UNIQUE NONCLUSTERED ([JobsFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[JobPhoneNumber] ADD CONSTRAINT [FK_JobPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[JobPhoneNumber] ADD CONSTRAINT [FK_JobPhoneNumber_JobPhoneType] FOREIGN KEY ([JobPhoneTypeFID]) REFERENCES [dbo].[JobPhoneType] ([JobPhoneTypeID])
GO
ALTER TABLE [dbo].[JobPhoneNumber] ADD CONSTRAINT [FK_JobPhoneNumber_Job] FOREIGN KEY ([JobsFID]) REFERENCES [dbo].[Jobs] ([JobsID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[JobPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[JobPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[JobPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[JobPhoneNumber] TO [MssExec]
GO