I try to drop a column in SQL but I am getting this error:
The object 'DF__...'is dependent on column ...
I found a lot of solutions that need to drop the Constraint first, so I ran this and worked:
ALTER TABLE [dbo].[Configuration] DROP CONSTRAINT DF__SiteConfi__Na__2DFCAC08;
ALTER TABLE [dbo].[Configuration] DROP COLUMN NaFlag;
But I need this script to run on any server, so I don't want to mention the Constraint name as it may be different on any other servers. What is the best solution?