提问人:Ahmed Adel 提问时间:1/25/2023 最后编辑:T NAhmed Adel 更新时间:1/25/2023 访问量:140
消息 156,级别 15,状态 1,第 21 行关键字“create”附近的语法不正确
Msg 156, Level 15, State 1, Line 21 Incorrect syntax near the keyword 'create'
问:
USE master;
GO
CREATE DATABASE Sales
ON
(NAME= Sales_Data,
FILENAME = 'F:\\DB\\Customer DB\\Sales_Data.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = Sales_Log,
FILENAME = 'F:\\DB\\Customer DB\\Sales_Log.ldf',
SIZE = 5,
MAXSIZE= 25,
FILEGROWTH = 5);
GO
USE Sales;
GO
CREATE SCHEMA Sales_schema;
CREATE SCHEMA Production;
USE Sales;
GO
CREATE TABLE Sales.sales.customers
(
customer_id int,
first_name varchar (15) NOT NULL,
last_name varchar (15) NOT NULL,
email_address varchar (50) NOT NULL,
phone varchar (15),
state varchar (15),
city varchar (15) NOT NULL,
street varchar (30) NOT NULL,
zip_code varchar (5) NOT NULL,
CONSTRAINT customers_uq UNIQUE KEY (phone),
CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
CREATE TABLE Production.categories
(
category_id INT PRIMARY KEY,
category_name VARCHAR (20)
);
CREATE TABLE Production.brands
(
brand_id INT,
brand_name VARCHAR (20),
CONSTRAINT brands_pk PRIMARY KEY (brand_id)
);
我预计根本没有错误,但我发现了多个错误。请检查这些意外错误
消息 156,级别 15,状态 1,第 21
行 关键字“create”附近的语法不正确。消息 1801,级别 16,状态 3,第 26
行数据库“SALES”已存在。选择其他数据库名称。消息 156,级别 15,状态 1,第 46
行关键字“CREATE”附近的语法不正确。消息 156,级别 15,状态 1,第 63
行关键字“key”附近的语法不正确。
答: 暂无答案
评论
CREATE TABLE
的文档,没有语法。我建议从一个工作示例开始,而不是只是在打字时编造......FILENAME= ''F:\...
CREATE DATABASE Sales
UNIQUE KEY