0
MSSQL 2014TSQL在另一個數據庫中刪除FK
在數據庫1中工作時,是否可以在數據庫2中刪除FK?
這不是爲我工作
use database1
go
IF EXISTS (SELECT 1 FROM database2.sys.foreign_keys WHERE object_id = OBJECT_ID(N'fk_in_tbl_in_other_db') AND parent_object_id = OBJECT_ID(N'database2.dbo.tableName'))
BEGIN
ALTER TABLE database2.dbo.tableName DROP CONSTRAINT fk_in_tbl_in_other_db;
END