CREATE TABLE [dbo].[ShTaxAuthorityTaxFlags]
(
[AuthorityTaxFlagID] [int] NOT NULL IDENTITY(1, 1),
[TaxAuthorityID] [int] NOT NULL,
[OverrideRate] [decimal] (18, 6) NULL,
[RateType] [int] NULL,
[TaxFlagID] [int] NOT NULL,
[TaxFlag] [int] NOT NULL,
[ItemUnitExceptionID] [int] NULL,
[TaxFlagExceptionID] [int] NULL,
[CreatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatorID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_ShTaxAuthorityTaxFlags_CreateDate] DEFAULT (getdate()),
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_ShTaxAuthorityTaxFlags_LastUpdate] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ShTaxAuthorityTaxFlags] ADD CONSTRAINT [PK__ShTaxAut__667F076AEB531C0F] PRIMARY KEY CLUSTERED ([AuthorityTaxFlagID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ShTaxAuthorityTaxFlags] ADD CONSTRAINT [FK_ShTaxAuthorityTaxFlags_ItemUnitExceptionID_shTaxExceptions] FOREIGN KEY ([ItemUnitExceptionID]) REFERENCES [dbo].[shTaxExceptions] ([ExceptionCodeID])
GO
ALTER TABLE [dbo].[ShTaxAuthorityTaxFlags] ADD CONSTRAINT [FK_ShTaxAuthorityTaxFlags_TaxAuthorityID_ShTaxAuthorities] FOREIGN KEY ([TaxAuthorityID]) REFERENCES [dbo].[ShTaxAuthorities] ([TaxAuthorityID])
GO
ALTER TABLE [dbo].[ShTaxAuthorityTaxFlags] ADD CONSTRAINT [FK_ShTaxAuthorityTaxFlags_TaxFlagExceptionID_shTaxExceptions] FOREIGN KEY ([TaxFlagExceptionID]) REFERENCES [dbo].[shTaxExceptions] ([ExceptionCodeID])
GO
ALTER TABLE [dbo].[ShTaxAuthorityTaxFlags] ADD CONSTRAINT [FK_ShTaxAuthorityTaxFlags_TaxFlagID_ShTaxFlags] FOREIGN KEY ([TaxFlagID]) REFERENCES [dbo].[ShTaxFlags] ([TaxFlagID])
GO