📅  最后修改于: 2022-03-11 15:05:17.034000             🧑  作者: Mango
DECLARE @sql NVARCHAR(MAX) = N'';
SELECT @sql += N'
ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))
+ '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) +
' DROP CONSTRAINT ' + QUOTENAME(name) + ';'
FROM sys.foreign_keys WHERE QUOTENAME(OBJECT_NAME(parent_object_id)) LIKE '%[tblAccount]%'
PRINT @sql;