Tables [dbo].[ReductionTemplateHeader]
Properties
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
HeapYes
Row Count (~)14
Created3:44:52 PM Tuesday, May 8, 2012
Last Modified8:55:47 AM Thursday, December 5, 2024
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentityDefault
Primary Key PK_ReductionTemplateHeader: ReductionTemplateIDReductionTemplateIDint4
No
1 - 1
Foreign Keys FK_ReductionTemplateHeader_ItemCode: [dbo].[ItemCode].ItemCodeFIDItemCodeFIDint4
Yes
Foreign Keys FK_ReductionTemplateHeader_Division: [dbo].[Division].DivisionFIDDivisionFIDint4
Yes
Descriptionvarchar(128)128
Yes
Foreign Keys FK_ReductionTemplateHeader_BranchFID: [dbo].[Branch].BranchFIDBranchFIDint4
Yes
Foreign Keys FK_ReductionTemplateHeader_DateBasisFID: [dbo].[DateBasis].DateBasisFIDDateBasisFIDint4
Yes
AgentTypeNamevarchar(16)16
Yes
Inactivebit1
No
((0))
IsAddbackBasedOnAgentPercentagebit1
No
((0))
Indexes Indexes
NameColumnsUnique
Primary Key PK_ReductionTemplateHeader: ReductionTemplateIDPK_ReductionTemplateHeaderReductionTemplateID
Yes
Check Constraints Check Constraints
NameConstraint
CK_ReductionTemplateHeader_Branch_AgentTypeName([BranchFID] IS NULL AND [AgentTypeName] IS NULL OR [BranchFID] IS NULL AND [AgentTypeName] IS NOT NULL OR [BranchFID] IS NOT NULL AND [AgentTypeName] IS NULL)
CK_ReductionTemplateHeader_Branch_Division((1)=[dbo].[IsDivisionValidForBranch]([BranchFID],[DivisionFID]))
Foreign Keys Foreign Keys
NameColumns
FK_ReductionTemplateHeader_BranchFIDBranchFID->[dbo].[Branch].[BranchPriKey]
FK_ReductionTemplateHeader_DateBasisFIDDateBasisFID->[dbo].[DateBasis].[DateBasisID]
FK_ReductionTemplateHeader_DivisionDivisionFID->[dbo].[Division].[DivisionID]
FK_ReductionTemplateHeader_ItemCodeItemCodeFID->[dbo].[ItemCode].[ICPriKey]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[ReductionTemplateHeader]
(
[ReductionTemplateID] [int] NOT NULL IDENTITY(1, 1),
[ItemCodeFID] [int] NULL,
[DivisionFID] [int] NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BranchFID] [int] NULL,
[DateBasisFID] [int] NULL,
[AgentTypeName] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Inactive] [bit] NOT NULL CONSTRAINT [DF_ReductionTemplateHeader_Inactive] DEFAULT ((0)),
[IsAddbackBasedOnAgentPercentage] [bit] NOT NULL CONSTRAINT [DF_ReductionTemplateHeader_IsAddbackBasedOnAgentPercentage] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [CK_ReductionTemplateHeader_Branch_AgentTypeName] CHECK (([BranchFID] IS NULL AND [AgentTypeName] IS NULL OR [BranchFID] IS NULL AND [AgentTypeName] IS NOT NULL OR [BranchFID] IS NOT NULL AND [AgentTypeName] IS NULL))
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [CK_ReductionTemplateHeader_Branch_Division] CHECK (((1)=[dbo].[IsDivisionValidForBranch]([BranchFID],[DivisionFID])))
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [PK_ReductionTemplateHeader] PRIMARY KEY NONCLUSTERED  ([ReductionTemplateID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [FK_ReductionTemplateHeader_BranchFID] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [FK_ReductionTemplateHeader_DateBasisFID] FOREIGN KEY ([DateBasisFID]) REFERENCES [dbo].[DateBasis] ([DateBasisID])
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [FK_ReductionTemplateHeader_Division] FOREIGN KEY ([DivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[ReductionTemplateHeader] ADD CONSTRAINT [FK_ReductionTemplateHeader_ItemCode] FOREIGN KEY ([ItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
GRANT SELECT ON  [dbo].[ReductionTemplateHeader] TO [MssExec]
GRANT INSERT ON  [dbo].[ReductionTemplateHeader] TO [MssExec]
GRANT DELETE ON  [dbo].[ReductionTemplateHeader] TO [MssExec]
GRANT UPDATE ON  [dbo].[ReductionTemplateHeader] TO [MssExec]
GO
Uses
Used By