注册 登录
编程论坛 SQL Server论坛

外键约束ON DELETE SET DEFAULT问题

goldroc 发布于 2010-07-13 10:01, 1213 次点击
create table tb_PostBlocks(
    Id int identity(1,1) primary key,
    BlockName varchar(100) not null unique,
    BlockDesc varchar(250)
)

create table tb_PostClassifies(
    Id int identity(1,1) primary key,
    BlockId int null default(1),
    ClassifyName varchar(50) not null unique,
    ClassifyDesc varchar(250),
    ClassifyLogo varchar(100),
    ClassifyOrder int default(0),
    foreign key(BlockId) references tb_PostBlocks(Id) ON DELETE SET DEFAULT
)

报错:在关键字 'SET' 附近有语法错误。
如果改成:foreign key(BlockId) references tb_PostBlocks(Id) ON DELETE CASCADE 就没问题。
请教各位高手,哪里出问题了,该怎么改呀?

[ 本帖最后由 goldroc 于 2010-7-13 15:54 编辑 ]
6 回复
#2
cnfarer2010-07-13 10:43
没有问题啊!!!(SQL Server 2005中执行正常)
#3
aei1352010-07-14 11:12
你的是SQL SERVER 2000吗?2000中不支持
#4
goldroc2010-07-14 14:51
回复 3楼 aei135
我装了sqlserver2005也不行啊
#5
aei1352010-07-15 08:54
你试试ROW_NUMBER能用么?如果这个不能用那就是SQL SERVER 2005没装好
#6
goldroc2010-07-15 10:38
估计是SQL SERVER 2005没装好,我再试试
1