if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ProductRecurringPatternXtab]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
 
CREATE TABLE [dbo].[ProductRecurringPatternXtab]
(
	[FK_ProductNumber] [int] NOT NULL,
	[FK_RecurringPatternID] [int] NOT NULL,
 CONSTRAINT [PK_ProductRecurringPatternXtab] PRIMARY KEY CLUSTERED 
(
	[FK_ProductNumber] ASC,
	[FK_RecurringPatternID] ASC
))
GO
ALTER TABLE [dbo].[ProductRecurringPatternXtab]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductRecurringPatternXtab_Products] FOREIGN KEY([FK_ProductNumber])
REFERENCES [dbo].[Products] ([ProductNumber])
GO

ALTER TABLE [dbo].[ProductRecurringPatternXtab] CHECK CONSTRAINT [FK_ProductRecurringPatternXtab_Products]
GO

ALTER TABLE [dbo].[ProductRecurringPatternXtab]  WITH NOCHECK ADD  CONSTRAINT [FK_ProductRecurringPatternXtab_RecurringPattern] FOREIGN KEY([FK_RecurringPatternID])
REFERENCES [dbo].[RecurringPattern] ([Id])
GO

ALTER TABLE [dbo].[ProductRecurringPatternXtab] CHECK CONSTRAINT [FK_ProductRecurringPatternXtab_RecurringPattern]
GO