How to drop a column which is having Default constraint in SQL Server 2008?
My query is
alter table tbloffers
drop column checkin
I am getting below error
ALTER TABLE DROP COLUMN checkin failed because one or more objects access this column.
Can anyone correct my query to drop a column with constraint?
First you should drop the problematic
DEFAULT constraint, after that you can drop the columnBut the error may appear from other reasons – for example the user defined function or view with
SCHEMABINDINGoption set for them.UPD:
Completely automated dropping of constraints script: