I just created a table as below in MS SQL
create table Employee
(emp_id smallint not null,
employee_name varchar (30) not null,
salary money not null,
department varchar(30),
address varchar(40),
primary key(emp_id)
)
After creating the table, I feel like auto populating the emp_id column( using Identity). So, I was trying to drop the column emp_id as below:
alter table Employee
drop column emp_id
Even though, I haven't inserted any rows in the table yet, I am getting the error
Msg 5074, Level 16, State 1, Line 1 The object 'PK__Employee__1299A86183CA4FBC' is dependent on column 'emp_id'. Msg 4922, Level 16, State 9, Line 1 ALTER TABLE DROP COLUMN emp_id failed because one or more objects access this column.
Please help!!!