IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[AttachmentHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[AttachmentHidden]
  (
    [AttachmentNumber] [int] IDENTITY(1,1) NOT NULL,
    [Name] [varchar](255) NULL,
    [FileGroup] [smallint] NOT NULL,
    [Batch] [bit] NOT NULL,
    [Readonly] [bit] NOT NULL,
    [AddressTypeNumber] [tinyint] NULL,
    [DateStamp] [smalldatetime] NOT NULL,
    [TemplateNumber] [smallint] NULL,
    [Blob] [image] NULL,
    [ReferenceNumber] [int] NOT NULL,
    [GuestNumber] [int] NOT NULL,
    [CustomerNumber] [int] NOT NULL,
    CONSTRAINT [PK_AttachmentHidden] PRIMARY KEY CLUSTERED 
    (
      [AttachmentNumber] ASC
    )
  ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

  ALTER TABLE [dbo].[AttachmentHidden] ADD  CONSTRAINT [DF__Attachmen__Batch__5F449142]  DEFAULT ((0)) FOR [Batch]

  ALTER TABLE [dbo].[AttachmentHidden] ADD  CONSTRAINT [DF__Attachmen__Reado__6038B57B]  DEFAULT ((0)) FOR [Readonly]
END

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[ReservationNotesHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[ReservationNotesHidden]
  (
    [ReferenceNumber] [int] NOT NULL,
    [GuestNumber] [smallint] NOT NULL,
    [Departments] [varchar](37) NULL,
    [Text] [text] NULL,
    [NotePage] [tinyint] NOT NULL,
    [DateStamp] [smalldatetime] NULL,
    [Lists] [varchar](30) NULL,
    [FK_HotelCustomerNumber] [int] NOT NULL,
    CONSTRAINT [PK_ReservationNotesHidden] PRIMARY KEY CLUSTERED 
    (
      [ReferenceNumber] ASC,
      [GuestNumber] ASC,
      [NotePage] ASC,
      [FK_HotelCustomerNumber] ASC
    )
  ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

  ALTER TABLE [dbo].[ReservationNotesHidden] ADD  CONSTRAINT [DF_ReservationNotesHidden_GuestNumber]  DEFAULT ((0)) FOR [GuestNumber]

  ALTER TABLE [dbo].[ReservationNotesHidden] ADD  CONSTRAINT [DF_ReservationNotesHidden_NotePage]  DEFAULT ((1)) FOR [NotePage]

  ALTER TABLE [dbo].[ReservationNotesHidden] ADD  CONSTRAINT [DF_ReservationNotesHidden_FK_HotelCustomerNumber]  DEFAULT ((-1)) FOR [FK_HotelCustomerNumber]
END

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[InetCustomerHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[InetCustomerHidden]
  (
    [CustomerNumber] [int] NOT NULL,
    [Customerlogin] [varchar](50) NOT NULL,
    [CustomerPassword] [varchar](50) NOT NULL,
    CONSTRAINT [PK_InetCustomerHidden] PRIMARY KEY CLUSTERED 
    (
      [CustomerNumber] ASC
    )
  ) ON [PRIMARY]
END

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[NoteContentsHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[NoteContentsHidden]
  (
    [CustomerNumber] [int] NOT NULL,
    [PageNumber] [smallint] NOT NULL,
    [Contents] [nvarchar](max) NULL,
    CONSTRAINT [PK_NoteContentsHidden] PRIMARY KEY CLUSTERED 
    (
      [CustomerNumber] ASC,
      [PageNumber] ASC
    )
  ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END