0

我有两张桌子TABLE_ACCOUNTTABLE_ACTYPE.

TABLE_ACCOUNT

 (CODE, NAME, TRADE, CATGORY, ACTYPE)

并且TABLE_ACTYPE有列

(CODE, NAME, ITYPE)

中的数据TABLE_ACTYPE是:

CODE     NAME     ITYPE
-----------------------
1        TRADE1    1
1        CAT1      2
1        ACT1      3

此表的主键是CODE, TYPE

中的数据TABLE_ACCOUNT是:

CODE, NAME, TRADE, CATEGORY, ACTYPE
-----------------------------------
1     Name1  1       1          1

我想为 to 创建 3 个外键table_account

ALTER TABLE TABLE_ACCOUNT WITH CHECK 
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_TRADE 
FOREIGN KEY ([TRADE,1]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)

ALTER TABLE TABLE_ACCOUNT WITH CHECK 
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_CAT 
FOREIGN KEY ([TRADE,2]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)

ALTER TABLE TABLE_ACCOUNT WITH CHECK 
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_ACTYPE 
FOREIGN KEY ([TRADE,3]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)

这可能吗??

4

1 回答 1

3

不。     

于 2012-12-20T10:28:40.990 回答