CREATE TABLE [dbo].[ARCustomerCustomProperties]
(
[CustomerCustomPropertyID] [int] NOT NULL IDENTITY(1, 1),
[CustomerID] [int] NOT NULL,
[ShAttributeID] [int] NOT NULL,
[IDVal] [int] NULL,
[TextVal] [varchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Required] [bit] NOT NULL CONSTRAINT [DF_ARCustomerCustomProperties_Required] DEFAULT ((0)),
[CreatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_ARCustomerCustomProperties_CreateDate] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ARCustomerCustomProperties] ADD CONSTRAINT [PK_ARCustomerCustomProperties] PRIMARY KEY CLUSTERED ([CustomerCustomPropertyID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ARCustomerCustomProperties] WITH NOCHECK ADD CONSTRAINT [FK_ARCustomerCustomProperties_CustomerID_ARCustomers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[ARCustomers] ([CustomerID])
GO
ALTER TABLE [dbo].[ARCustomerCustomProperties] ADD CONSTRAINT [FK_ARCustomerCustomProperties_ShAttributeID_ShAttributes] FOREIGN KEY ([ShAttributeID]) REFERENCES [dbo].[ShAttributes] ([ShAttributeID])
GO