【SQL开源代码栏目提醒】:本文主要为网学会员提供createtables.sql,希望对需要createtables.sql网友有所帮助,学习一下!
/****** Object: Database park Script Date: 2003-5-21 15:04:59 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'park')
DROP DATABASE [park]
GO
CREATE DATABASE [park]
COLLATE Chinese_PRC_CS_AS
GO
exec sp_dboption N'park', N'autoclose', N'true'
GO
exec sp_dboption N'park', N'bulkcopy', N'false'
GO
exec sp_dboption N'park', N'trunc. log', N'true'
GO
exec sp_dboption N'park', N'torn page detection', N'true'
GO
exec sp_dboption N'park', N'read only', N'false'
GO
exec sp_dboption N'park', N'dbo use', N'false'
GO
exec sp_dboption N'park', N'single', N'false'
GO
exec sp_dboption N'park', N'autoshrink', N'true'
GO
exec sp_dboption N'park', N'ANSI null default', N'false'
GO
exec sp_dboption N'park', N'recursive triggers', N'false'
GO
exec sp_dboption N'park', N'ANSI nulls', N'false'
GO
exec sp_dboption N'park', N'concat null yields null', N'false'
GO
exec sp_dboption N'park', N'cursor close on commit', N'false'
GO
exec sp_dboption N'park', N'default to local cursor', N'false'
GO
exec sp_dboption N'park', N'quoted identifier', N'false'
GO
exec sp_dboption N'park', N'ANSI warnings', N'false'
GO
exec sp_dboption N'park', N'auto create statistics', N'true'
GO
exec sp_dboption N'park', N'auto update statistics', N'true'
GO
use [park]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Selected_Class_Class]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Selected_Class] DROP CONSTRAINT FK_Selected_Class_Class
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Login_Student]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Login] DROP CONSTRAINT FK_Login_Student
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Selected_Class_Student]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Selected_Class] DROP CONSTRAINT FK_Selected_Class_Student
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Class_Teacher]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Class] DROP CONSTRAINT FK_Class_Teacher
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Login_Teacher]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Login] DROP CONSTRAINT FK_Login_Teacher
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Login_UserView]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Login] DROP CONSTRAINT FK_Login_UserView
GO
/****** Object: Table [dbo].[Class] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Class]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Class]
GO
/****** Object: Table [dbo].[Classes] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Classes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Classes]
GO
/****** Object: Table [dbo].[Content] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Content]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Content]
GO
/****** Object: Table [dbo].[Course] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Course]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Course]
GO
/****** Object: Table [dbo].[Enum] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Enum]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Enum]
GO
/****** Object: Table [dbo].[Login] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Login]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Login]
GO
/****** Object: Table [dbo].[Navigator] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Navigator]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Navigator]
GO
/****** Object: Table [dbo].[Selected_Class] Script Date: 2003-5-21 15:04:59 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Selected_Class