IF NOT EXISTS(SELECT * FROM sys.tables (NOLOCK) WHERE name = 'RoomTypeRoomTypeXTAB')
BEGIN
	CREATE TABLE [dbo].[RoomTypeRoomTypeXTAB](
		[PrimaryRoomTypeNumber] [int] NOT NULL,
		[SecondayRoomTypeNumber] [int] NOT NULL,
		[Priority] [int] NOT NULL,
	 CONSTRAINT [PK_RoomTypeRoomTypeXTAB] PRIMARY KEY CLUSTERED 
	(
		[PrimaryRoomTypeNumber] ASC,
		[SecondayRoomTypeNumber] 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].[RoomTypeRoomTypeXTAB]  WITH CHECK ADD  CONSTRAINT [FK_RoomTypeRoomTypeXTAB_RoomTypes] FOREIGN KEY([PrimaryRoomTypeNumber])
	REFERENCES [dbo].[RoomTypes] ([RoomTypeNumber])

	ALTER TABLE [dbo].[RoomTypeRoomTypeXTAB] CHECK CONSTRAINT [FK_RoomTypeRoomTypeXTAB_RoomTypes]

	ALTER TABLE [dbo].[RoomTypeRoomTypeXTAB]  WITH CHECK ADD  CONSTRAINT [FK_RoomTypeRoomTypeXTAB_RoomTypes1] FOREIGN KEY([SecondayRoomTypeNumber])
	REFERENCES [dbo].[RoomTypes] ([RoomTypeNumber])

	ALTER TABLE [dbo].[RoomTypeRoomTypeXTAB] CHECK CONSTRAINT [FK_RoomTypeRoomTypeXTAB_RoomTypes1]
END


