CREATE TABLE [dbo].[SalesTeamSplit]
(
[SalesTeamSplitID] [int] NOT NULL IDENTITY(1, 1),
[AccountProfileFID] [int] NOT NULL,
[SysUserLaborTypeMapFID] [int] NOT NULL,
[Percentage] [decimal] (12, 2) NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SalesTeamSplit] ADD CONSTRAINT [CK_SalesTeamSplit_Percentage] CHECK (([Percentage]>(0) AND [Percentage]<=(100)))
GO
ALTER TABLE [dbo].[SalesTeamSplit] ADD CONSTRAINT [PK_SalesTeamSplit] PRIMARY KEY NONCLUSTERED ([SalesTeamSplitID]) ON [PRIMARY]
GO
CREATE UNIQUE CLUSTERED INDEX [IX_SalesTeamSplit_AccountProfileFID_SysUserLaborTypeMapFID] ON [dbo].[SalesTeamSplit] ([AccountProfileFID], [SysUserLaborTypeMapFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SalesTeamSplit] ADD CONSTRAINT [FK_SalesTeamSplit_AccountProfiles] FOREIGN KEY ([AccountProfileFID]) REFERENCES [dbo].[AccountProfiles] ([AccountProfileID])
GO
ALTER TABLE [dbo].[SalesTeamSplit] ADD CONSTRAINT [FK_SalesTeamSplit_SysUserLaborTypeMap] FOREIGN KEY ([SysUserLaborTypeMapFID]) REFERENCES [dbo].[SysUserLaborTypeMap] ([SysUserLaborTypeMapID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[SalesTeamSplit] TO [MssExec]
GRANT INSERT ON [dbo].[SalesTeamSplit] TO [MssExec]
GRANT DELETE ON [dbo].[SalesTeamSplit] TO [MssExec]
GRANT UPDATE ON [dbo].[SalesTeamSplit] TO [MssExec]
GO