if exists (select * from dbo.sysobjects where id = object_id(N'[VOTE_RESULTS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [VOTE_RESULTS]
GO

CREATE TABLE [VOTE_RESULTS] (
	[VOTE_ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
	[QUESTION_ID] [numeric](18, 0) NOT NULL ,
	[ANSWER_ID] [nvarchar] (10)  NOT NULL ,
	[USER_IP] [nvarchar] (15)  NOT NULL ,
	[SUBMITTED_DATE] [datetime] NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [VOTE_RESULTS] WITH NOCHECK ADD 
	CONSTRAINT [PK_VOTE_RESULTS] PRIMARY KEY  CLUSTERED 
	(
		[VOTE_ID]
	)  ON [PRIMARY] 
GO



EXEC sp_bindefault N'[DF_CREATED]', N'[VOTE_RESULTS].[SUBMITTED_DATE]'
GO


ALTER TABLE [VOTE_RESULTS] ADD 
	CONSTRAINT [FK_VOTE_RESULTS_CONTENT_ITEM] FOREIGN KEY 
	(
		[QUESTION_ID]
	) REFERENCES [CONTENT_ITEM] (
		[CONTENT_ITEM_ID]
	) ON DELETE CASCADE 
GO