添加外鍵
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) )