IF NOT EXISTS(SELECT Name FROM Sysobjects WHERE Name = 'Tbl_ScoreClub')
BEGIN 
CREATE TABLE [dbo].[Tbl_ScoreClub](
	[Autoid] [INT] IDENTITY(1,1) NOT NULL,
	[Id_Club] [INT] NOT NULL,
	[NuFactor] [VARCHAR](10) NOT NULL,
	[Year] [VARCHAR](4) NOT NULL,
	[PriceFactor] [MONEY] NOT NULL,
	[Score] [FLOAT] NULL,
	[Id_Havaleh] [BIGINT] NULL,
	[FactorGuid] [UNIQUEIDENTIFIER] NULL,
	[FactorDate] [DATETIME] NULL,
 CONSTRAINT [PK_Tbl_ScoreClub] PRIMARY KEY CLUSTERED 
(
	[Autoid] ASC
)
) ON [PRIMARY]

ALTER TABLE [dbo].[Tbl_ScoreClub] ADD  DEFAULT (GETDATE()) FOR [FactorDate]

ALTER TABLE [dbo].[Tbl_ScoreClub]  WITH CHECK ADD  CONSTRAINT [FK_Tbl_ScoreClub_Tbl_ClubH] FOREIGN KEY([Id_Club])
REFERENCES [dbo].[Tbl_ClubH] ([AutoId])
ON DELETE CASCADE

ALTER TABLE [dbo].[Tbl_ScoreClub] CHECK CONSTRAINT [FK_Tbl_ScoreClub_Tbl_ClubH]
End

