I have a table student containing a date column dateModified which is not nullable. I want to change the column data type to datetime. I tried following sql in the MSSql server:
ALTER table student alter column dateModified datetime not null
and getting following error:
The object '....' is dependent on column 'dateModified'
ALTER TABLE STUDENT ALTER COLUMN DATEMODIFIED DATETIME NOT NULL failed because one or more objects access this column.
There is no constraints depending on the column. there is a primary key which is not related to the column.
There are thousands of existing records in the student. I tried running the sql in a empty table and it worked without any errors. Could anyone please tell me how can I alter the table without removing any records from the table? If possible please also provide a sql for Oracle sql. Thanks in advance.