CREATE TABLE [dbo].[Accounts]
(
[AcctNo] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AcctName] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Contact] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[County] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Note] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel1] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel2] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel3] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel4] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel5] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel6] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel7] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedLabel8] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UserDefinedActive1] [int] NULL,
[UserDefinedActive2] [int] NULL,
[UserDefinedActive3] [int] NULL,
[UserDefinedActive4] [int] NULL,
[UserDefinedActive5] [int] NULL,
[UserDefinedActive6] [int] NULL,
[UserDefinedActive7] [int] NULL,
[UserDefinedActive8] [int] NULL,
[AccountPriKey] [int] NOT NULL IDENTITY(1, 1),
[BranchPriKey] [int] NOT NULL,
[DepartmentAgency] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BureauService] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Inactive] [bit] NOT NULL CONSTRAINT [DF_Accounts_Inactive] DEFAULT ((0)),
[DefaultLocationCode] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DefaultClientID] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DefaultSubAccount] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Accounts] ADD CONSTRAINT [PK_ACCOUNTS] PRIMARY KEY NONCLUSTERED ([AccountPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Accounts] ADD CONSTRAINT [IX_Accounts] UNIQUE NONCLUSTERED ([AcctNo]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Accounts] ADD CONSTRAINT [FK_ACCOUNTS_BRANCH] FOREIGN KEY ([BranchPriKey]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
GRANT SELECT ON [dbo].[Accounts] TO [MssExec]
GRANT INSERT ON [dbo].[Accounts] TO [MssExec]
GRANT DELETE ON [dbo].[Accounts] TO [MssExec]
GRANT UPDATE ON [dbo].[Accounts] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'This table stores national account records', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key of this table', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'AccountPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'National account name', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'AcctName'
GO
EXEC sp_addextendedproperty N'MS_Description', N'National account identification number', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'AcctNo'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Key linking this table to a particular branch', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'BranchPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Credit bureau services that the national account belongs to', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'BureauService'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Name of the primary contact', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'Contact'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Count code for the national account', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'County'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Department or agency that the national account belongs to', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'DepartmentAgency'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default note associated to the national account', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'Note'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 1 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive1'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 2 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive2'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 3 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive3'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 4 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive4'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 5 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive5'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 6 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive6'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 7 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive7'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Set this flag to 1 to activate the User Defined Label 8 value', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedActive8'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 1 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel1'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 2 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel2'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 3 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel3'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 4 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel4'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 5 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel5'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 6 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel6'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 7 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel7'
GO
EXEC sp_addextendedproperty N'MS_Description', N'User defined label in position 8 for the Customer Specific fields', 'SCHEMA', N'dbo', 'TABLE', N'Accounts', 'COLUMN', N'UserDefinedLabel8'
GO