IF NOT EXISTS(SELECT * FROM sys.tables (NOLOCK) WHERE name = 'CampaignCodesExtra')
BEGIN
	CREATE TABLE [dbo].[CampaignCodesExtra](
		[FK_CampaignCode] [smallint] NOT NULL,
		[FK_HotelCustomerNumber] [int] NOT NULL,
		[FK_WareNumber] [int] NOT NULL,
		[ExtraType] [smallint] NOT NULL,
		[Value] [float] NOT NULL
	 CONSTRAINT [PK_CampaignCodesExtra] PRIMARY KEY CLUSTERED 
	(
		[FK_CampaignCode] ASC,
		[FK_HotelCustomerNumber] 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].[CampaignCodesExtra]  WITH CHECK ADD  CONSTRAINT [FK_CampaignCodesExtra_CampaignCode] FOREIGN KEY([FK_CampaignCode])
	REFERENCES [dbo].[CampaignCodes] ([PK_CampaignCode])

	ALTER TABLE [dbo].[CampaignCodesExtra] CHECK CONSTRAINT [FK_CampaignCodesExtra_CampaignCode]

	ALTER TABLE [dbo].[CampaignCodesExtra]  WITH CHECK ADD  CONSTRAINT [FK_CampaignCodesExtra_HotelCustomerNumber1] FOREIGN KEY([FK_HotelCustomerNumber])
	REFERENCES [dbo].[Customer] ([CustomerNumber])

	ALTER TABLE [dbo].[CampaignCodesExtra] CHECK CONSTRAINT [FK_CampaignCodesExtra_HotelCustomerNumber1]

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

	ALTER TABLE [dbo].[CampaignCodesExtra] CHECK CONSTRAINT [FK_CampaignCodesExtra_WareNumber1]
END