添加外鍵

alter table CodeInfo drop constraint FK_CodeInfo_CodeCa
alter table CodeInfo add  constraint FK_CodeInfo_CodeCa  foreign key(CategoryID) references CodeCategory(CategoryID)

create table CodeInfo
(
    CodeID int identity(1,1) primary key
    ,CategoryID varchar(8) references CodeCategory(CategoryID)
    ,CodeName nvarchar(8)
)

 

posted @ 2013-01-17 01:40  sirili  阅读(135)  评论(0编辑  收藏  举报