[dbo].[AccountProfileServices]
This table associates available services and their corresponding status to an account profile record
CREATE TABLE [dbo].[AccountProfileServices]
(
[AccountProfileServiceID] [int] NOT NULL IDENTITY(1, 1),
[AccountProfileFID] [int] NOT NULL,
[AccountProfileAvailableServiceFID] [int] NOT NULL,
[AccountProfileServiceStatusFID] [int] NOT NULL,
[Comment] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileServices] ADD CONSTRAINT [PK_AccountProfileServices] PRIMARY KEY NONCLUSTERED ([AccountProfileServiceID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileServices] ADD CONSTRAINT [ix_AccountProfileServices_AccountProfile_AccountProfileAvailableService] UNIQUE NONCLUSTERED ([AccountProfileFID], [AccountProfileAvailableServiceFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ix_AccountProfileServices_AccountProfile] ON [dbo].[AccountProfileServices] ([AccountProfileFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfileServices] ADD CONSTRAINT [FK_AccountProfileServices_AccountProfileAvailableServices] FOREIGN KEY ([AccountProfileAvailableServiceFID]) REFERENCES [dbo].[AccountProfileAvailableServices] ([AccountProfileAvailableServiceID])
GO
ALTER TABLE [dbo].[AccountProfileServices] ADD CONSTRAINT [FK_AccountProfileServices_AccountProfile] FOREIGN KEY ([AccountProfileFID]) REFERENCES [dbo].[AccountProfiles] ([AccountProfileID])
GO
ALTER TABLE [dbo].[AccountProfileServices] ADD CONSTRAINT [FK_AccountProfileServices_AccountProfileServiceStatus] FOREIGN KEY ([AccountProfileServiceStatusFID]) REFERENCES [dbo].[AccountProfileServiceStatus] ([AccountProfileServiceStatusID])
GO
GRANT SELECT ON [dbo].[AccountProfileServices] TO [MssExec]
GRANT INSERT ON [dbo].[AccountProfileServices] TO [MssExec]
GRANT DELETE ON [dbo].[AccountProfileServices] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountProfileServices] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'This table associates available services and their corresponding status to an account profile record', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a particular available service', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', 'COLUMN', N'AccountProfileAvailableServiceFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a particular account profile', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', 'COLUMN', N'AccountProfileFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key of this table', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', 'COLUMN', N'AccountProfileServiceID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a particular service status', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', 'COLUMN', N'AccountProfileServiceStatusFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Comments pertaining to the account profile service ', 'SCHEMA', N'dbo', 'TABLE', N'AccountProfileServices', 'COLUMN', N'Comment'
GO