IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[WareAllotmentXTab]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[WareAllotmentXTab]
  (
    [FK_WareNumber] [int] NOT NULL,
    [FK_AllotmentNumber] [int] NOT NULL,
    CONSTRAINT [PK_WareAllotmentXTab] PRIMARY KEY CLUSTERED 
    (
      [FK_WareNumber] ASC,
      [FK_AllotmentNumber] ASC
    )
  ) ON [PRIMARY]

  ALTER TABLE [dbo].[WareAllotmentXTab]  WITH CHECK ADD  CONSTRAINT [FK_WareAllotmentXTab_Allotments] FOREIGN KEY([FK_AllotmentNumber])
  REFERENCES [dbo].[Allotments] ([AllotmentNumber])

  ALTER TABLE [dbo].[WareAllotmentXTab] CHECK CONSTRAINT [FK_WareAllotmentXTab_Allotments]

  ALTER TABLE [dbo].[WareAllotmentXTab]  WITH CHECK ADD  CONSTRAINT [FK_WareAllotmentXTab_Ware] FOREIGN KEY([FK_WareNumber])
  REFERENCES [dbo].[Ware] ([WareNumber])

  ALTER TABLE [dbo].[WareAllotmentXTab] CHECK CONSTRAINT [FK_WareAllotmentXTab_Ware]
END