IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TBOLUMRUHSAT]') AND type in (N'U'))
BEGIN
	CREATE TABLE [dbo].[TBOLUMRUHSAT]
	(
		[BOLUMRUHSATID] [int] IDENTITY(1,1) NOT NULL,
		[SUBEID] [int] NOT NULL,
		[BOLUMID] [int] NOT NULL,
		[RUHSATNO] [nvarchar](50) NOT NULL,
		CONSTRAINT [PK_TBOLUMRUHSAT] PRIMARY KEY CLUSTERED 
		(
			[BOLUMRUHSATID] ASC
		)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,										ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY]
	
	ALTER TABLE [dbo].[TBOLUMRUHSAT]  WITH CHECK ADD  CONSTRAINT [FK_TBOLUMRUHSAT_TBOLUMRUHSAT] FOREIGN KEY([BOLUMID])
	REFERENCES [dbo].[TBOLUM] ([BOLUMID])
	
	ALTER TABLE [dbo].[TBOLUMRUHSAT] CHECK CONSTRAINT [FK_TBOLUMRUHSAT_TBOLUMRUHSAT]
	
	ALTER TABLE [dbo].[TBOLUMRUHSAT]  WITH CHECK ADD  CONSTRAINT [FK_TBOLUMRUHSAT_TBOLUMRUHSAT1] FOREIGN KEY([BOLUMRUHSATID])
	REFERENCES [dbo].[TBOLUMRUHSAT] ([BOLUMRUHSATID])
	
	ALTER TABLE [dbo].[TBOLUMRUHSAT] CHECK CONSTRAINT [FK_TBOLUMRUHSAT_TBOLUMRUHSAT1]
END
go




