X First find the constraint name
And then delete it
I'll give you an example.
--Test environment
--Main Table
CREATE table test1 (ID int primary key not null,value int)
Insert Test1 Select 1,2
Go
--From the table
CREATE table test2 (id int references test1 (ID), value int)
Go
--First step: Find out the FOREIGN KEY constraint name on the Test2 table
--2000
exec sp_helpconstraint ' test2 '
--The FOREIGN KEY constraint name can be found in the Constraint_name property
--2005
Select Name
From Sys.foreign_key_columns F join sys.objects O on f.constraint_object_id=o.object_id
where f.parent_object_id=object_id (' test2 ')
/*
Name
---------------------------------
fk__test2__id__08ea5793*/
--Step Two: Delete the foreign KEY constraint
ALTER TABLE TEST2 drop constraint fk__test2__id__08ea5793
--Step Three: Check if there are foreign key constraints on the table
--just use the Find statement in the first step