Re: some error in table definition



On 10月30日, 下午7时54分, "Roy Harvey (SQL Server MVP)"
<roy_har...@xxxxxxxx> wrote:
On Tue, 30 Oct 2007 10:35:08 -0000, cong <franzca...@xxxxxxxxx> wrote:
IS_ORIGIONAL bit NOT NULL,
CONSTRAINT DF_BBSItem_IS_ORIGIONAL DEFAULT(0),
AUTHOR nvarchar(15) COLLATE Chinese_PRC_CS_AS NOT NULL,
row 9:ITEM_CONTENT nvarchar(3000) COLLATE Chinese_PRC_CS_AS NOT NULL,
constraint 'TABLE' definition wrong in gramma??

A constraint that comes after a comma is a table constraint. Table
constraints must be specified AFTER all the columns. Since this is a
DEFAULT constraint that must be associated with a column remove the
comma and make it a column constraint.

BROWSED_TIMES smallint NOT NULL
CONSTRAINT DF_BBSItem_BROWSED_TIMES DEFAULT(0),
LATEST_REPLICATION_ID int NULL

When you get past that you will find that CLUSTERD is not the correct
spelling of the keyword CLUSTERED. And you might prefer to spell
ORIGIONAL as ORIGINAL, and if REPLYD is supposed to be the past tense
of REPLY then you might want REPLYED.

Roy Harvey
Beacon Falls, CT

this is an example in a chinese book about ASP .

thank you for your reply, and I have a new problem. I uesd MYSQL
before,don't familiar with SQL SERVER


if exists(select * from dbo.sysobjects where id =
object_id(N'BBSItems')
and OBJECTPROPERTY(id,N'IsUserTable')=1)
drop table BBSItems
GO

CREATE TABLE BBSItems(
ITEM_ID int IDENTITY(1,1) NOT NULL,
ITEM_TITLE nvarchar(30) COLLATE Chinese_PRC_CS_AS NOT NULL,
ITEM_CONTENT nvarchar(3000) COLLATE Chinese_PRC_CS_AS NOT NULL,
COMPOSE_DATE smalldatetime NOT NULL,
MODIFY_DATE smalldatetime NULL,
IS_ORIGIONAL bit NOT NULL
CONSTRAINT DF_BBSItem_IS_ORIGIONAL DEFAULT(0),
AUTHOR nvarchar(15) COLLATE Chinese_PRC_CS_AS NOT NULL,
FATHER_ID int NULL,
REPLYD_TIMES smallint NOT NULL
CONSTRAINT DF_BBSItem_REPLYD_TIMES DEFAULT(0),
BROWSED_TIMES smallint NOT NULL
CONSTRAINT DF_BBSItem_BROWSED_TIMES DEFAULT(0),
LATEST_REPLICATION_ID int NULL,

CONSTRAINT PK_BBSItems PRIMARY KEY CLUSTERED
(
ITEM_ID
) ON PRIMARY,
CONSTRAINT FK_BBSItem_BBSItem1 FOREIGN KEY
(
LATEST_REPLICATION_ID
)REFERENCES BBSItems(
ITEM_ID),
CONSTRAINT FK_BBSItem_UserInfo FOREIGN KEY
(
AUTHOR
)REFERENCES 个人信息(昵称)
)
ON PRIMARY
)
GO

ROW 21:NEAR KEYWORD "PRIMARY" WRONG IN GRAMMA

THANK YOU!

.



Relevant Pages

  • Problem merging two queries
    ... CONSTRAINT PRIMARY KEY CLUSTERED ... REFERENCES ( ... CONSTRAINT FOREIGN KEY ...
    (microsoft.public.sqlserver.programming)
  • RE: udf in computed column
    ... > EmployeeTypeId INT NOT NULL, ... > CONSTRAINT PK_EmployeeTypes PRIMARY KEY NONCLUSTERED ... > EmployeeId INT NOT NULL, ... > Created DATETIME NOT NULL DEFAULT), ...
    (microsoft.public.sqlserver.programming)
  • udf in computed column
    ... EmployeeTypeId INT NOT NULL, ... CONSTRAINT PK_EmployeeTypes PRIMARY KEY NONCLUSTERED ... EmployeeId INT NOT NULL, ... AbsenceTypeId INT NOT NULL, ...
    (microsoft.public.sqlserver.programming)
  • Re: A Generic Generics Problem
    ... struct MySumwhere T: struct, ... public static T AddInteger(T value, ... > the TypeConverter. ... >>> constraint language details). ...
    (microsoft.public.dotnet.languages.csharp)
  • Query optimizer question
    ... type int. ... CONSTRAINT PRIMARY KEY CLUSTERED ... CONSTRAINT FOREIGN KEY ... REFERENCES.( ...
    (microsoft.public.sqlserver.programming)