在文件组上创建新的群集表

qij5mzcb  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(203)

我经常收到一条错误消息,语法不正确 ON . 有人能帮我找出原因吗?

CREATE TABLE [CustomerService.Contacts]

(

        --A

        ContactID int IDENTITY(1,1),

        CONSTRAINT PK_ContactID PRIMARY KEY CLUSTERED (ContactID),

        --B

        CustomerID int not null,

        CONSTRAINT FK_CustomerID FOREIGN KEY (CustomerID)

        REFERENCES Sales.Customer (CustomerID),

        --C

        RepID int not null,

        CONSTRAINT FK_RepID FOREIGN KEY (RepID)

        REFERENCES CustomerService.Reps (RepID),

        --D

        ContactDateTime date not null,

        --E

        ContactMethod varchar(5) DEFAULT 'Other' not null,

        CHECK (ContactMethod IN ('Email', 'Phone', 'Chat', 'Other')),

        --F

        ContactPhone varchar(14) null,

        --G

        ContactEmail varchar(50) null,

        --H

        ContactDetail varchar(MAX) not null,

ON  AD_CustomerService;

GO

ALTER TABLE CustomerService.Contacts

REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE);

GO
nle07wnf

nle07wnf1#

您从未关闭在第一行之后打开的括号:

CREATE TABLE [CustomerService.Contacts]

(

所以在 ON 关键字:

...
        ContactDetail varchar(MAX) not null,

        )  -- <---this was missing

ON  AD_CustomerService;

GO

ALTER TABLE CustomerService.Contacts

REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE);

GO

相关问题