IF NOT EXISTS (SELECT * FROM  SYSOBJECTS
      WHERE SYSOBJECTS.name = 'HIZOLASYON') 
BEGIN
	CREATE TABLE [dbo].[HIZOLASYON](
		[HIZOLASYONID] [int] NOT NULL,
		[BASTARIH] [datetime] NULL,
		[BITTARIH] [datetime] NULL,
		[SPID] [int] NOT NULL,
		[IZOLASYONTURU] [int] NOT NULL,
		[BIRIMID] [int] NOT NULL,
		[HKIMLIKID] [int] NULL,
		HYATISID  [int] NULL,
		[ACIKLAMA] [ntext] NOT NULL,
		[KAYITTARIHI] [datetime] NULL,
		[KAYITKULLANICI] [nvarchar](25) NULL,
		[SGTARIHI] [datetime] NULL,
		[SGKULLANICI] [nvarchar](25) NULL,
		[SUBEID] [int] NULL,
	 CONSTRAINT [PK_HIZOLASYON] PRIMARY KEY CLUSTERED 
	(
		[HIZOLASYONID] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
	) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO

IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[HIZOLASYON]') AND 
name = N'IX_HIZOLASYON_HKIMLIKID_SUBEID')
BEGIN

	CREATE NONCLUSTERED INDEX [IX_HIZOLASYON_HKIMLIKID_SUBEID] ON [dbo].[HIZOLASYON]
	(
		[HKIMLIKID] ASC,
		[SUBEID] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
END
GO

