0

I have altered a table "luAffinity" by adding an additional column "AOTProcessRealTime" to it. I have added a default constraint to the column "AOTProcessRealTime". Below is the query that I have fired:

ALTER TABLE luAffinity ADD AOTProcessRealTime BIT NOT NULL CONSTRAINT DF_luAffinity_ProcessRealTime DEFAULT 0

Now I wanted to delete the column AOTProcessRealTime. For this, I have to delete the default constraint first. So I wrote the following query to delete the constraint:

ALTER TABLE luAffinity DROP CONSTRAINT DF_luAffinity_ProcessRealTime

On running the above query, I am gettin an error:

DF_luAffinity_ProcessRealTime is not a constraint. Could not drop constraint.

However, the constraint has been successfully created but I am not able to delete it. I just wanted to delete the column AOTProcessRealTime. But I am not able to delete it. Am I doing something wrong? Any help will be appreciated

1 Answer 1

2

For SQL Server, your syntax should work. Perhaps there is a subtle typo in the name of the constraint? Use

SELECT *
 from sys.default_constraints
 where parent_object_id = object_id('luAffinity')

to check how it is currently set.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Philip. I found out the problem. The name was stated different when ran the above query

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.