| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 662 人关注过本帖
标题:数据库脚本文件创建数据库
只看楼主 加入收藏
qizhongshun
Rank: 2
等 级:论坛游民
威 望:1
帖 子:31
专家分:26
注 册:2011-9-16
结帖率:100%
收藏
 问题点数:0 回复次数:1 
数据库脚本文件创建数据库
程序代码:
高手指点一下:
下面程序错在哪里/? 运行总是出错
USE [db_DrinkeryManage]
GO
/****** Object:  Table [dbo].[tb_menu]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_menu](
    [num] [char](8) NOT NULL,
    [sort_id] [int] NOT NULL,
    [name] [varchar](20) NOT NULL,
    [code] [varchar](10) NOT NULL,
    [unit] [varchar](4) NOT NULL,
    [unit_price] [int] NOT NULL,
    [state] [char](4) NOT NULL,

 CONSTRAINT [PK_TB_MENU] PRIMARY KEY CLUSTERED
(
    [num] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[tb_desk]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_desk](
    [num] [varchar](5) NOT NULL,
    [seating] [int] NOT NULL,

 CONSTRAINT [PK_TB_DESK] PRIMARY KEY CLUSTERED
(
    [num] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[tb_user]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_user](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [name] [varchar](8) NOT NULL,
    [sex] [char](2) NOT NULL,
    [birthday] [datetime] NOT NULL,
    [id_card] [varchar](20) NOT NULL,
    [password] [varchar](20) NOT NULL,
    [freeze] [char](4) NOT NULL,

 CONSTRAINT [PK_TB_USER] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[tb_sort]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_sort](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [name] [varchar](20) NOT NULL,

 CONSTRAINT [PK_TB_SORT] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[tb_order_form]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_order_form](
    [num] [char](11) NOT NULL,
    [desk_num] [varchar](5) NOT NULL,
    [datetime] [datetime] NULL,
    [money] [int] NOT NULL,
    [user_id] [int] NOT NULL,

 CONSTRAINT [PK_TB_ORDER_FORM] PRIMARY KEY CLUSTERED
(
    [num] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[tb_order_item]    Script Date: 06/03/2012 15:22:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tb_order_item](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [order_form_num] [char](11) NOT NULL,
    [menu_num] [char](8) NOT NULL,
    [amount] [int] NOT NULL,
    [total] [int] NOT NULL,

 CONSTRAINT [PK_TB_ITEMIZE] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  ForeignKey [FK_TB_ORDER_REFERENCE_TB_DESK]    Script Date: 06/03/2012 15:22:35 ******/
ALTER TABLE [dbo].[tb_order_form]  WITH CHECK ADD  CONSTRAINT [FK_TB_ORDER_REFERENCE_TB_DESK] FOREIGN KEY([desk_num])
REFERENCES [dbo].[tb_desk] ([num])
GO
ALTER TABLE [dbo].[tb_order_form] CHECK CONSTRAINT [FK_TB_ORDER_REFERENCE_TB_DESK]
GO
/****** Object:  ForeignKey [FK_TB_ORDER_REFERENCE_TB_USER]    Script Date: 06/03/2012 15:22:35 ******/
ALTER TABLE [dbo].[tb_order_form]  WITH NOCHECK ADD  CONSTRAINT [FK_TB_ORDER_REFERENCE_TB_USER] FOREIGN KEY([user_id])
REFERENCES [dbo].[tb_user] ([id])
GO
ALTER TABLE [dbo].[tb_order_form] CHECK CONSTRAINT [FK_TB_ORDER_REFERENCE_TB_USER]
GO
/****** Object:  ForeignKey [FK_TB_ITEMI_REFERENCE_TB_MENU]    Script Date: 06/03/2012 15:22:35 ******/
ALTER TABLE [dbo].[tb_order_item]  WITH NOCHECK ADD  CONSTRAINT [FK_TB_ITEMI_REFERENCE_TB_MENU] FOREIGN KEY([menu_num])
REFERENCES [dbo].[tb_menu] ([num])
GO
ALTER TABLE [dbo].[tb_order_item] CHECK CONSTRAINT [FK_TB_ITEMI_REFERENCE_TB_MENU]
GO
/****** Object:  ForeignKey [FK_TB_ITEMI_REFERENCE_TB_ORDER]    Script Date: 06/03/2012 15:22:35 ******/
ALTER TABLE [dbo].[tb_order_item]  WITH NOCHECK ADD  CONSTRAINT [FK_TB_ITEMI_REFERENCE_TB_ORDER] FOREIGN KEY([order_form_num])
REFERENCES [dbo].[tb_order_form] ([num])
GO
ALTER TABLE [dbo].[tb_order_item] CHECK CONSTRAINT [FK_TB_ITEMI_REFERENCE_TB_ORDER]
GO
搜索更多相关主题的帖子: 数据库 
2012-06-04 09:46
qizhongshun
Rank: 2
等 级:论坛游民
威 望:1
帖 子:31
专家分:26
注 册:2011-9-16
收藏
得分:0 
CONSTRAINT [PK_TB_ORDER_FORM] PRIMARY KEY CLUSTERED
(
    [num] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CONSTRAINT [PK_TB_SORT] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CONSTRAINT [PK_TB_USER] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CONSTRAINT [PK_TB_SORT] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CONSTRAINT [PK_TB_ORDER_FORM] PRIMARY KEY CLUSTERED
(
    [num] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CONSTRAINT [PK_TB_ITEMIZE] PRIMARY KEY CLUSTERED
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO提示: 在创建逐渐约束的地方有错误提示信息第 12 行: '(' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 7
第 7 行: '(' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 12
第 12 行: '(' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 7
第 7 行: '(' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 10
第 10 行: '(' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 10
第 10 行: '(' 附近有语法错误。
服务器: 消息 4902,级别 16,状态 1,行

提示: 在创建逐渐约束的地方有错误提示信息
2012-06-04 09:55
快速回复:数据库脚本文件创建数据库
数据加载中...
 
   



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

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