
IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSOBJECTS.name = 'HEMSIREBILDIRIM')
			  
CREATE TABLE [dbo].[HEMSIREBILDIRIM](
	[HEMSIREBILDIRIMID] [int] NOT NULL,
	[TARIH] [datetime] NULL,
	[SPID] [int] NOT NULL,
	[BIRIMID] [int] NOT NULL,
	[VARDIYA] [int] NOT NULL,
	[NARKOTIK] [int] NOT NULL,
	[HKIMLIKID] [int] NULL,
	[ARIZABILDIRIMI] [int] NOT NULL,
	[ARIZAID] [int] NULL,
	[ACIKLAMA] [ntext] NOT NULL,
	[ONAYLANDI] [bit] NOT NULL,
	[ONAYLAYAN] [nvarchar](25) NULL,
	[ONAYZAMANI] [datetime] NULL,
	[ONAYACIKLAMA] [ntext] NULL,
	KAYITTARIHI [datetime] NULL,
	KAYITKULLANICI [nvarchar](25) NULL,
    SGTARIHI [datetime] NULL,
	SGKULLANICI [nvarchar](25) NULL,
	SUBEID [int] NULL

 CONSTRAINT [PK_HEMSIREBILDIRIM] PRIMARY KEY CLUSTERED 
(
	[HEMSIREBILDIRIMID] 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]
GO

IF NOT EXISTS (SELECT * FROM  SYSOBJECTS 
              WHERE SYSOBJECTS.name = 'DF_HEMSIREBILDIRIM_ONAYLANDI')
ALTER TABLE [dbo].[HEMSIREBILDIRIM] ADD  CONSTRAINT [DF_HEMSIREBILDIRIM_ONAYLANDI]  DEFAULT ((0)) FOR [ONAYLANDI]
GO

