use master
go
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'学生档案管理')
DROP DATABASE [学生档案管理]
GO
CREATE DATABASE [学生档案管理]
GO
use [学生档案管理]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_成绩信息表_学生基本信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[成绩信息表] DROP CONSTRAINT FK_成绩信息表_学生基本信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_家庭成员信息表_学生基本信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[家庭成员信息表] DROP CONSTRAINT FK_家庭成员信息表_学生基本信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_奖惩信息表_学生基本信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[奖惩信息表] DROP CONSTRAINT FK_奖惩信息表_学生基本信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_学籍异动信息表_学生基本信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[学籍异动信息表] DROP CONSTRAINT FK_学籍异动信息表_学生基本信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_注册信息表_学生基本信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[注册信息表] DROP CONSTRAINT FK_注册信息表_学生基本信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_课程分配信息表_班级信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[课程分配信息表] DROP CONSTRAINT FK_课程分配信息表_班级信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_学生基本信息表_班级信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[学生基本信息表] DROP CONSTRAINT FK_学生基本信息表_班级信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_班级信息表_系信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[班级信息表] DROP CONSTRAINT FK_班级信息表_系信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_成绩信息表_课程信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[成绩信息表] DROP CONSTRAINT FK_成绩信息表_课程信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_课程分配信息表_课程信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[课程分配信息表] DROP CONSTRAINT FK_课程分配信息表_课程信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_系信息表_院信息表]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[系信息表] DROP CONSTRAINT FK_系信息表_院信息表
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[奖惩信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[奖惩信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[学生基本信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[学生基本信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[学籍异动信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[学籍异动信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[家庭成员信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[家庭成员信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[成绩信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[成绩信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[注册信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[注册信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[班级信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[班级信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[用户信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[用户信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[系信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[系信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[课程信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[课程信息表]
GO
if exists (select * from dbo.s�