September 16, 2008 at 4:39 pm
Hello,
I have 3 tables, the 3rd table has a composiite key. I would like to delete the primary key from the 3rd table. Here are the tables and the Alter syntax that I attempted along with the error message I'm receiving.
Any help appreciated.
CREATE Table Groups
(GroupID INT Identity Primary Key,
GroupName Varchar (20) NOT NUll,
Dues money Default 0 CHECK (Dues >= 0))
CREATE Table Individuals
(IndividualID INT Identity Primary Key,
FirstName Varchar (20) NOT NUll,
LastName Varchar (20) NOT NUll,
Address Varchar (20) NOT NUll,
Phone Varchar (13)) --Null allowed since the user may not have a phone
CREATE Table GroupMembership
(GroupID INT Identity REFERENCES dbo.Groups (GroupID),
IndividualID INT NOT NUll REFERENCES dbo.Individuals (IndividualID)
PRIMARY KEY (GroupID, IndividualID))
ALTER TABLE [GroupMembership]
DROP CONSTRAINT pk_GroupMembership
ERROR:
Msg 3728, Level 16, State 1, Line 1
'pk_GroupMembership' is not a constraint.
Msg 3727, Level 16, State 0, Line 1
Could not drop constraint. See previous errors.
September 16, 2008 at 5:18 pm
pk_GroupMembership is not the name of the constraint. Run SP_HELP GroupMembership and see what is returned for constraint_name.
Greg
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply