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

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

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

CREATE TABLE [dbo].[chapter] (
	[fldAuto] [int] IDENTITY (1, 1) NOT NULL ,
	[faq_fldAuto] [int] NULL ,
	[name] [nvarchar] (50) NULL ,
	[orderingfield] [nvarchar] (10) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[faq] (
	[fldAuto] [int] IDENTITY (1, 1) NOT NULL ,
	[name] [nvarchar] (50) NULL ,
	[descr] [nvarchar] (255) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[question] (
	[fldAuto] [int] IDENTITY (1, 1) NOT NULL ,
	[chapter_fldAuto] [int] NULL ,
	[question] [nvarchar] (255) NULL ,
	[answer] [ntext] NULL ,
	[orderingfield] [nvarchar] (10) NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

