IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSOBJECTS.name = 'HCGMDOKUMAN')

CREATE TABLE [dbo].[HCGMDOKUMAN](
	[ID] [int] NOT NULL,
	[HDOSYAID] [int] NULL,
	[CARIID] [int] NULL,
	[CLAIMID] [nvarchar](50) NULL,
	[FILENAME] [nvarchar](500) NULL,
	[FILEPATH] [nvarchar](500) NULL,
	[DOCUMENTEXTTYPE] [nvarchar](10) NULL,
	[DOCUMENTTYPEID] [nvarchar](50) NULL,
	[DOCUMENTXMLETIKETI] [nvarchar](100) NULL,
	[EFATURAETTN] [nvarchar](38) NULL,
	[EFATNO] [nvarchar](50) NULL,
	[CUSTOMERID] [int] NULL,
	[KYTARIH] [datetime] NULL,
	[KYKULLANICI] [nvarchar](50) NULL,
	[SGTARIH] [datetime] NULL,
	[SGKULLANICI] [nvarchar](50) NULL,
	[DOCUMENTRESULT] [nvarchar](250) NULL,
	[FATURATARIHI] [datetime] NULL,
	[FOYGONDERILDI] [bit] NOT NULL,
	[PAKETNO] [nvarchar](50) NULL,
	[FOYNOTU] [nvarchar](50) NULL,
	[DOSYATESLIMNO] [nvarchar](50) NULL,
	[FOLDERID]  [nvarchar](50) NULL,
	[HSTEFATNO] [nvarchar](50) NULL,
	[HSTFATURATARIHI] [datetime] NULL
 CONSTRAINT [PK_HCGMDOKUMAN] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

IF NOT EXISTS (SELECT * FROM sys.all_objects  WHERE name = 'DF_HCGMDOKUMAN_FOYGONDERILDI')
ALTER TABLE [dbo].[HCGMDOKUMAN] ADD  CONSTRAINT [DF_HCGMDOKUMAN_FOYGONDERILDI]  DEFAULT ((0)) FOR [FOYGONDERILDI]
GO


