CREATE TABLE [dbo].[VanlineAddress]
(
[VanlineAddressID] [int] NOT NULL IDENTITY(1, 1),
[VanlineFID] [int] NOT NULL,
[VanlineAddressTypeFID] [int] NOT NULL,
[Title] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Contact] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Address] [dbo].[Address] NULL,
[City] [dbo].[AddressCity] NULL,
[State] [dbo].[AddressState] NULL,
[PostalCode] [dbo].[AddressPostalCode] NULL,
[CountryCodeStandardFID] [int] NOT NULL,
[County] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Email] [varchar] (120) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VanlineAddress] ADD CONSTRAINT [PK_VanlineAddress] PRIMARY KEY CLUSTERED ([VanlineAddressID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VanlineAddress] ADD CONSTRAINT [FK_VanlineAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[VanlineAddress] ADD CONSTRAINT [FK_VanlineAddress_VanlineAddressType] FOREIGN KEY ([VanlineAddressTypeFID]) REFERENCES [dbo].[VanlineAddressType] ([VanlineAddressTypeID])
GO
ALTER TABLE [dbo].[VanlineAddress] ADD CONSTRAINT [FK_VanlineAddress_Vanline] FOREIGN KEY ([VanlineFID]) REFERENCES [dbo].[VanLine] ([VLPriKey]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[VanlineAddress] TO [MssExec]
GRANT INSERT ON [dbo].[VanlineAddress] TO [MssExec]
GRANT DELETE ON [dbo].[VanlineAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[VanlineAddress] TO [MssExec]
GO