title: SQL Server 2005 drop column with constraints
body: <p>I have a column with a "DEFAULT" constraint. I'd like to create a script that drops that column.</p>
  
  <p>The problem is that it returns this error:</p>
  
  <pre><code>Msg 5074, Level 16, State 1, Line 1  
  The object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'. 
  Msg 4922, Level 16, State 9, Line 1 
  ALTER TABLE DROP COLUMN IsClosed failed because one or more objects access this column.
  </code></pre>
  
  <p>I couldn't find an easy way to drop a column and all its associated constraints (only found big scripts that look into the system table... there MUST (!!) be a "nice" way to do it.)</p>
  
  <p>And as the DEFAULT constraint's name has been randomly generated, I can't drop it by name.</p>
  
  <hr>
  
  <p><strong>Update</strong> :<br>
  The constraint type is "DEFAULT".</p>
  
  <p>I saw the solutions that you all proposed but I find them all really "dirty"... Don't you think?
  I don't know if it's with Oracle or MySQL but it's possible to do something like:</p>
  
  <pre><code>DROP COLUMN xxx CASCADE CONSTRAINTS 
  </code></pre>
  
  <p>And it drops all related constraints... 
  Or at least it automatically drops the constraints mapped to that column (at least CHECK constraints!)</p>
  
  <p>Is there nothing like that in MSSQL?</p>