IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'chr6p21annotation')
	DROP DATABASE [chr6p21annotation]
GO

CREATE DATABASE [chr6p21annotation]  ON (NAME = N'chr6p21annotation_Data', FILENAME = N'E:\www_db\MSSQL\Data\chr6p21annotation_Data.MDF' , SIZE = 1870, FILEGROWTH = 10%) LOG ON (NAME = N'chr6p21annotation_Log', FILENAME = N'E:\www_db\MSSQL\Data\chr6p21annotation_log.LDF' , SIZE = 1082, FILEGROWTH = 10%)
 COLLATE Latin1_General_CI_AS
GO

exec sp_dboption N'chr6p21annotation', N'autoclose', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'bulkcopy', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'trunc. log', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'torn page detection', N'true'
GO

exec sp_dboption N'chr6p21annotation', N'read only', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'dbo use', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'single', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'autoshrink', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'ANSI null default', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'recursive triggers', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'ANSI nulls', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'concat null yields null', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'cursor close on commit', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'default to local cursor', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'quoted identifier', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'ANSI warnings', N'false'
GO

exec sp_dboption N'chr6p21annotation', N'auto create statistics', N'true'
GO

exec sp_dboption N'chr6p21annotation', N'auto update statistics', N'true'
GO

if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
	exec sp_dboption N'chr6p21annotation', N'db chaining', N'false'
GO

use [chr6p21annotation]
GO

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

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

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

CREATE TABLE [dbo].[exon] (
	[exon_id] [int] IDENTITY (1, 1) NOT NULL ,
	[exon_nr] [int] NULL ,
	[gene_id] [int] NULL ,
	[Chrom] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[SNPper_PositionStart] [float] NULL ,
	[SNPper_PositionEnd] [float] NULL ,
	[row_entered_date] [smalldatetime] NULL ,
	[row_entered_user] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
	[row_entered_comment] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[row_active] [bit] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[gene] (
	[gene_id] [int] IDENTITY (100000, 1) NOT NULL ,
	[gene_priority] [int] NULL ,
	[gene_name] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
	[gene_class] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
	[gene_description] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[SNPper_Gene_id] [int] NULL ,
	[row_entered_date] [smalldatetime] NULL ,
	[row_entered_user] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[row_comment] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[row_active] [bit] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[sequence] (
	[sequence_id] [int] IDENTITY (1, 1) NOT NULL ,
	[sequence_name] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[sequence_source] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[sequence_type] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[dbSNP_submitter] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[sequence] [ntext] COLLATE Latin1_General_CI_AS NULL ,
	[dbSNP_update] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[dbSNP] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[dbSNP_info] [text] COLLATE Latin1_General_CI_AS NULL ,
	[gene_id] [int] NULL ,
	[Chrom] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[Band] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[GenBank] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[GoldenPath] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[PositionGenbank] [float] NULL ,
	[PositionGoldenPath] [float] NULL ,
	[SNPper_Position] [float] NULL ,
	[SNPper_Allele] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[SNPper_Relpos] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[SNPper_Role] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[SNPper_Function] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[PositionChrom] [float] NULL ,
	[DistanceToLast] [float] NULL ,
	[Comment] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[Status] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[row_entered_date] [smalldatetime] NULL ,
	[row_entered_user] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
	[row_comment] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL ,
	[row_active] [bit] NULL ,
	[selected030405] [bit] NULL ,
	[stat030808] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

