我有两张桌子:
CREATE TABLE dbo.country
(
cntry_id VARCHAR(2) NOT NULL,
name VARCHAR(50) NOT NULL,
CONSTRAINT pk_country PRIMARY KEY (cntry_id)
CREATE TABLE dbo.city
(
city_id VARCHAR(3) NOT NULL,
name VARCHAR(50) NOT NULL,
cntry_id VARCHAR(2) NOT NULL,
CONSTRAINT pk_city PRIMARY KEY (city_id),
FOREIGN KEY (cntry_id) REFERENCES dbo.country(cntry_id)
)
我正在尝试放弃 fk 约束,这样我就可以放弃桌子了。
FK 定义存在:
EXEC sp_fkeys country
pktable_qualifier pktable_owner pk_tablename ...
xxxxxx xxx country cntry_id ....
(数据库名称模糊)
但两者
EXEC sp_dropkey foreign, country, city
EXEC sp_dropkey foreign, city, country
返回
264 Error (17499) No foreign key for the table or view exists. sp_dropkey(263)
有人知道如何丢弃这些钥匙吗?
先感谢您
瑞安