[dbo].[VendorConnectBranch]
CREATE TABLE [dbo].[VendorConnectBranch]
(
[VendorConnectBranchID] [int] NOT NULL IDENTITY(1, 1),
[VendorConnectFID] [int] NOT NULL,
[BranchFID] [int] NOT NULL,
[ExternalCode] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Inactive] [bit] NOT NULL CONSTRAINT [DF_VendorConnectBranch_Inactive] DEFAULT ((0)),
[AgentConnectCode] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [PK_VendorConnectBranch] PRIMARY KEY CLUSTERED ([VendorConnectBranchID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [IX_VendorConnectBranch_AgentConnectCode] UNIQUE NONCLUSTERED ([AgentConnectCode], [VendorConnectBranchID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [IX_VendorConnectBranch_VendorConnect_Branch] UNIQUE NONCLUSTERED ([VendorConnectFID], [BranchFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [IX_VendorConnectBranch_VendorConnect_ExternalCode] UNIQUE NONCLUSTERED ([VendorConnectFID], [ExternalCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [FK_VendorConnectBranch_Branch] FOREIGN KEY ([BranchFID]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[VendorConnectBranch] ADD CONSTRAINT [FK_VendorConnectBranch_VendorConnect] FOREIGN KEY ([VendorConnectFID]) REFERENCES [dbo].[VendorConnect] ([VendorConnectID])
GO
GRANT SELECT ON [dbo].[VendorConnectBranch] TO [MssExec]
GRANT INSERT ON [dbo].[VendorConnectBranch] TO [MssExec]
GRANT DELETE ON [dbo].[VendorConnectBranch] TO [MssExec]
GRANT UPDATE ON [dbo].[VendorConnectBranch] TO [MssExec]
GO