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

  ALTER TABLE [dbo].[ArrangementLineArrangementLineXTab]  WITH CHECK ADD  CONSTRAINT [FK_ArrangementLineArrangementLineXTab_ArrangementLines] FOREIGN KEY([FK_ArrangementLineNumber])
  REFERENCES [dbo].[ArrangementLines] ([ArrangementLineNumber])

  ALTER TABLE [dbo].[ArrangementLineArrangementLineXTab] CHECK CONSTRAINT [FK_ArrangementLineArrangementLineXTab_ArrangementLines]

  ALTER TABLE [dbo].[ArrangementLineArrangementLineXTab]  WITH CHECK ADD  CONSTRAINT [FK_ArrangementLineArrangementLineXTab_ArrangementLines1] FOREIGN KEY([FK_ArrangementLineNumberSub])
  REFERENCES [dbo].[ArrangementLines] ([ArrangementLineNumber])

  ALTER TABLE [dbo].[ArrangementLineArrangementLineXTab] CHECK CONSTRAINT [FK_ArrangementLineArrangementLineXTab_ArrangementLines1]
END