[dbo].[AccountingVendorAddress]
CREATE TABLE [dbo].[AccountingVendorAddress]
(
[AccountingVendorAddressId] [int] NOT NULL IDENTITY(1, 1),
[AccountingVendorFid] [int] NOT NULL,
[AccountingVendorAddressTypeFid] [int] NOT NULL,
[Address1] [dbo].[Address] NULL,
[Address2] [dbo].[Address] NULL,
[Address3] [dbo].[Address] NULL,
[City] [dbo].[AddressCity] NULL,
[State] [dbo].[AddressState] NULL,
[PostalCode] [dbo].[AddressPostalCode] NULL,
[CountryCodeStandardFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountingVendorAddress] ADD CONSTRAINT [PK_AccountingVendorAddress] PRIMARY KEY NONCLUSTERED ([AccountingVendorAddressId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountingVendorAddress] ADD CONSTRAINT [IX_AccountingVendorAddress_AccountingVendorFid_AccountingVendorAddressTypeFid] UNIQUE CLUSTERED ([AccountingVendorFid], [AccountingVendorAddressTypeFid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountingVendorAddress] ADD CONSTRAINT [FK_AccountingVendorAddress_AccountingVendorAddressType] FOREIGN KEY ([AccountingVendorAddressTypeFid]) REFERENCES [dbo].[AccountingVendorAddressType] ([AccountingVendorAddressTypeId])
GO
ALTER TABLE [dbo].[AccountingVendorAddress] ADD CONSTRAINT [FK_AccountingVendorAddress_AccountingVendor] FOREIGN KEY ([AccountingVendorFid]) REFERENCES [dbo].[AccountingVendor] ([AccountingVendorId]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountingVendorAddress] ADD CONSTRAINT [FK_AccountingVendorAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
GRANT SELECT ON [dbo].[AccountingVendorAddress] TO [MssExec]
GRANT INSERT ON [dbo].[AccountingVendorAddress] TO [MssExec]
GRANT DELETE ON [dbo].[AccountingVendorAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountingVendorAddress] TO [MssExec]
GO