Invalid scripting for FK deleting using "IF OBJECT_ID('FK_...', 'F') IS NOT NULL" check.
Invalid scripting for FK deleting using "IF OBJECTID('FK...', 'F') IS NOT NULL" check.
There is need to use schema as part of FK name. Reason: "OBJECT_ID() function returns NULL for "non-dbo schema" FK.
Bad script:
IF OBJECTID('FKFDlalala', 'F') IS NOT NULL
ALTER TABLE EE.FDlalala
DROP CONSTRAINT FKFDlalala
GO
Uber script:
IF OBJECTID('EE.FKFDlalala', 'F') IS NOT NULL
ALTER TABLE EE.FDlalala
DROP CONSTRAINT FKFDlalala
GO
3
votes
Дмитрий Иванов
shared this idea
This issue is fixed in dbForge Studio for SQL Server, v5.1 https://www.devart.com/dbforge/sql/studio/download.html
-
Anonymous commented
+100500