IF NOT EXISTS
(
  SELECT * FROM SysObjects WITH (NOLOCK) 
    WHERE SysObjects.Name = 'AllotmentPaymentXTAB'
)
BEGIN

	CREATE TABLE [dbo].[AllotmentPaymentXTAB](
	[FK_AllotmentNumber] [int] NOT NULL,
	[FK_Warenumber] [int] NOT NULL,
	 CONSTRAINT [PK_AllotmentPaymentXTAB] PRIMARY KEY CLUSTERED 
	(
		[FK_AllotmentNumber] ASC,
		[FK_Warenumber] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY]

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

	ALTER TABLE [dbo].[AllotmentPaymentXTAB] CHECK CONSTRAINT [FK_AllotmentPaymentXTAB_Allotments]

	ALTER TABLE [dbo].[AllotmentPaymentXTAB]  WITH CHECK ADD  CONSTRAINT [FK_AllotmentPaymentXTAB_Ware] FOREIGN KEY([FK_Warenumber])
	REFERENCES [dbo].[Ware] ([WareNumber])

	ALTER TABLE [dbo].[AllotmentPaymentXTAB] CHECK CONSTRAINT [FK_AllotmentPaymentXTAB_Ware]

END