IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[HotelManagerAdditional]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE [dbo].[HotelManagerAdditional](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[FK_HotelCustomerNumber] [int] NOT NULL,
	[Datestamp] [datetime] NOT NULL,
	[Turnover] [money] NULL,
	[WorkHours] [int] NULL,
 CONSTRAINT [PK_HotelManagerAdditional] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY]
END
GO

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME='FK_HotelManagerAdditional_Customer')
BEGIN
  ALTER TABLE [dbo].[HotelManagerAdditional]  WITH CHECK ADD CONSTRAINT [FK_HotelManagerAdditional_Customer] FOREIGN KEY([FK_HotelCustomerNumber])
  REFERENCES [dbo].[Customer] ([CustomerNumber])
  ALTER TABLE [dbo].[HotelManagerAdditional] CHECK CONSTRAINT [FK_HotelManagerAdditional_Customer]
END
GO