

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EGITIMDOKUMAN]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[EGITIMDOKUMAN](
	[EGITIMDOKUMANID] [int] NOT NULL,
	[EGITIMID] [int] NOT NULL,
	[TARIH] [datetime] NOT NULL,
	[ACIKLAMA] [nvarchar](200) NULL,
	[ADRES] [nvarchar](200) NOT NULL,
	[DOSYA] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_EGITIMDOKUMAN] PRIMARY KEY CLUSTERED 
(
	[EGITIMDOKUMANID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
go

IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_EGITIMDOKUMAN_EGITIM]') AND parent_object_id = OBJECT_ID(N'[dbo].[EGITIMDOKUMAN]'))
ALTER TABLE [dbo].[EGITIMDOKUMAN] WITH CHECK ADD  CONSTRAINT [FK_EGITIMDOKUMAN_EGITIM] FOREIGN KEY([EGITIMID])
REFERENCES [dbo].[PEGITIM] ([EGITIMID])
go
