I have a field ID that has been set as a primary key and null, I tried to change it to not null with the code below but I got an error saying ALTER TABLE ALTER COLUMN ID failed because one or more objects access this column. how can i change it without dropping the table.
ALTER TABLE [dbo].[RCHOLE]
ALTER COLUMN ID varchar(18) NOT NULL
You Got This Error Because RCHOLE_Block_ID is Dependent On ID Column so You have To Remove Dependency to add NOT Null Constraint.In You Case Error show that So You have To Remove That Dependency To Apply NOT NULL constraint