if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DebtorAccounting]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE [dbo].[DebtorAccounting](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[BillNumber] [int] NOT NULL,
	[HotelCustomerNumber] [int] NOT NULL,
	[FKDepartment] [smallint] NOT NULL,
	[FK_UserIdNumber] [int] NOT NULL,
	[DateStamp] [datetime] NOT NULL,
	[Amount] [float] NOT NULL,
 CONSTRAINT [PK_DebtorAccounting] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY]

ALTER TABLE [dbo].[DebtorAccounting]  WITH CHECK ADD  CONSTRAINT [FK_DebtorAccounting_PERSONEL] FOREIGN KEY([FK_UserIdNumber])
REFERENCES [dbo].[PERSONEL] ([UserIDNumber])

ALTER TABLE [dbo].[DebtorAccounting] CHECK CONSTRAINT [FK_DebtorAccounting_PERSONEL]

END