2 years ago

#75937

test-img

dimitri

How to drop column that already have default value in existing table?

I've added a column to an existing table like that:

ALTER TABLE [dbo].[tbl_exampleTable] 
    ADD ExampleName varchar(1) NOT NULL DEFAULT('w');   

It successfully added this column.

But when I try to drop this column, like that:

ALTER TABLE [dbo].[tbl_exampleTable] 
    DROP COLUMN ExampleName;    

I can't do this, and every time I see the error like that, but I'm sure that there is no procedures or other things that can use this column.

ALTER TABLE DROP COLUMN ExampleName failed because one or more objects access this column.

How can I drop this column?

sql

sql-server

tsql

ssms

drop

0 Answers

Your Answer

Accepted video resources