CREATE TABLE [dbo].[BranchAddress]
(
[BranchAddressID] [int] NOT NULL IDENTITY(1, 1),
[BranchFID] [int] NOT NULL,
[BranchAddressTypeFID] [int] NOT NULL,
[Title] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Contact] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Address] [varchar] (256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[City] [varchar] (26) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[State] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Zip] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[County] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Email] [varchar] (120) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Phone] [dbo].[PhoneCombined] NULL,
[PhoneExt] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Fax] [dbo].[PhoneCombined] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BranchAddress] ADD CONSTRAINT [PK_BranchAddress] PRIMARY KEY CLUSTERED ([BranchAddressID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BranchAddress] ADD CONSTRAINT [IX_Unique_BranchFID_BranchAddressTypeFID] UNIQUE NONCLUSTERED ([BranchFID], [BranchAddressTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BranchAddress] ADD CONSTRAINT [FK_BranchAddress_BranchAddressType] FOREIGN KEY ([BranchAddressTypeFID]) REFERENCES [dbo].[BranchAddressType] ([BranchAddressTypeID])
GO
ALTER TABLE [dbo].[BranchAddress] ADD CONSTRAINT [FK_BranchAddress_Branch] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
GRANT SELECT ON [dbo].[BranchAddress] TO [MssExec]
GRANT INSERT ON [dbo].[BranchAddress] TO [MssExec]
GRANT DELETE ON [dbo].[BranchAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[BranchAddress] TO [MssExec]
GO