CREATE TABLE [dbo].[ICItemSubstitutes]
(
[ItemID] [int] NOT NULL,
[SubstituteID] [int] NOT NULL,
[CreatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_ICItemSubstitutes_CreateDate] DEFAULT (getdate()),
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_ICItemSubstitutes_LastUpdate] DEFAULT (getdate()),
[timestamp] [timestamp] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ICItemSubstitutes] ADD CONSTRAINT [PK_ICItemSubstitutes] PRIMARY KEY CLUSTERED ([ItemID], [SubstituteID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ICItemSubstitutes] ADD CONSTRAINT [FK_ICItemSubstitutes_ItemID_ICItems] FOREIGN KEY ([ItemID]) REFERENCES [dbo].[ICItems] ([ItemID])
GO
ALTER TABLE [dbo].[ICItemSubstitutes] ADD CONSTRAINT [FK_ICItemSubstitutes_SubstituteID_ICItems] FOREIGN KEY ([SubstituteID]) REFERENCES [dbo].[ICItems] ([ItemID])
GO