| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 972 人关注过本帖
标题:求助: 服务器: 消息 170,级别 15,状态 1,行 9
取消只看楼主 加入收藏
shanshan1
Rank: 1
来 自:哈尔滨
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-25
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:0 
求助: 服务器: 消息 170,级别 15,状态 1,行 9
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID (N'[dbo].[Depart]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Depart](
    [departID] [int] IDENTITY(1,1) NOT NULL,
    [departName] [varchar](100) NULL,
 CONSTRAINT [PK_Depart] PRIMARY KEY CLUSTERED
(
    [departID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID (N'[dbo].[Users]')AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Users](
    [adminName] [varchar](20) NOT NULL,
    [adminPwd] [varchar](20) NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
(
    [adminName] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Teacher]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Teacher](
    [teaID] [varchar](20) NOT NULL,
    [teaPwd] [varchar](20) NULL,
    [teaName] [varchar](50) NOT NULL,
    [teaDepart] [int] NULL,
 CONSTRAINT [PK_Teacher] PRIMARY KEY CLUSTERED
(
    [teaID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Student]') AND type in (N'U'))
BEGIN

CREATE TABLE [dbo].[Student](
    [stuID] [varchar](20) NOT NULL,
    [stuPwd] [varchar](20) NULL,
    [stuName] [varchar](10) NOT NULL,
    [stuDepart] [int] NULL,
    [stuGrade] [int] NULL,
    [stuClass] [int] NULL,
 CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED
(
    [stuID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Cource]') AND type in (N'U'))
BEGIN

CREATE TABLE [dbo].[Cource](
    [courceID] [varchar](20) NOT NULL,
    [teaID] [varchar](20) NOT NULL,
    [courceName] [varchar](100) NOT NULL,
    [courceTime] [varchar](20) NULL,
    [courceAddress] [varchar](50) NULL,
    [courceInfo] [text] NULL,
 CONSTRAINT [PK_Cource_1] PRIMARY KEY CLUSTERED
(
    [courceID] ASC,
    [teaID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Elect]') AND type in (N'U'))
BEGIN

CREATE TABLE [dbo].[Elect](
    [stuID] [varchar](20) NOT NULL,
    [courceID] [varchar](20) NOT NULL,
    [teaID] [varchar](20) NOT NULL,
    [Score] [int] NULL,
 CONSTRAINT [PK_Elect] PRIMARY KEY CLUSTERED
(
    [stuID] ASC,
    [courceID] ASC,
    [teaID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Teacher_Depart]') AND parent_object_id = OBJECT_ID(N'[dbo].[Teacher]'))
ALTER TABLE [dbo].[Teacher]  WITH CHECK ADD  CONSTRAINT [FK_Teacher_Depart] FOREIGN KEY([teaDepart])
REFERENCES [dbo].[Depart] ([departID])
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Student_Depart]') AND parent_object_id = OBJECT_ID(N'[dbo].[Student]'))
ALTER TABLE [dbo].[Student]  WITH CHECK ADD  CONSTRAINT [FK_Student_Depart] FOREIGN KEY([stuDepart])
REFERENCES [dbo].[Depart] ([departID])
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Cource_Teacher]') AND parent_object_id = OBJECT_ID(N'[dbo].[Cource]'))
ALTER TABLE [dbo].[Cource]  WITH CHECK ADD  CONSTRAINT [FK_Cource_Teacher] FOREIGN KEY([teaID])
REFERENCES [dbo].[Teacher] ([teaID])
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Elect_Cource]') AND parent_object_id = OBJECT_ID(N'[dbo].[Elect]'))
ALTER TABLE [dbo].[Elect]  WITH CHECK ADD  CONSTRAINT [FK_Elect_Cource] FOREIGN KEY([courceID], [teaID])
REFERENCES [dbo].[Cource] ([courceID], [teaID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Elect_Student]') AND parent_object_id = OBJECT_ID(N'[dbo].[Elect]'))
ALTER TABLE [dbo].[Elect]  WITH CHECK ADD  CONSTRAINT [FK_Elect_Student] FOREIGN KEY([stuID])
REFERENCES [dbo].[Student] ([stuID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
IF NOT EXISTS (SELECT * FROM 'sys.foreign_keys' WHERE object_id = OBJECT_ID(N'[dbo].[FK_Elect_Teacher]') AND parent_object_id = OBJECT_ID(N'[dbo].[Elect]'))
ALTER TABLE [dbo].[Elect]  WITH CHECK ADD  CONSTRAINT [FK_Elect_Teacher] FOREIGN KEY([teaID])
REFERENCES [dbo].[Teacher] ([teaID])

这是源码  请高手帮帮忙 ,正在做毕业设计   谢谢    急。。。。
搜索更多相关主题的帖子: 服务器 级别 状态 
2010-05-25 15:53
快速回复:求助: 服务器: 消息 170,级别 15,状态 1,行 9
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018911 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved