views:

149

answers:

1

I'm using Microsoft SQL Server 2005, and am relatively new to SQL in general.

There is a relationship between two tables, "Resources" and "Group_Resources", in the database "Information". Resources has a foreign key, "id", in Group_Resources, named "resource_id". There is a foreign key constraint, "fk_gr_res_resources", between the two.

I'm established as the database owner, and have full read/write/create/delete permissions.

I want to delete the foreign key constraint, so I executed the following query:

ALTER TABLE [Information].[group_resources] DROP CONSTRAINT fk_gr_res_resources

and received the following error:

'fk_gr_res_resources' is not a constraint. Could not drop constraint. See previous errors.

I'm confused, because it is a constraint, and there are no spelling errors. Am I going about deleting this improperly? Am I deleting the constraint from the incorrect table? Any suggestions would be greatly appreciated, & please don't flame me: I am new to SQL after all.

A: 
JohnB
Thanks for the code example. I put in the following:"ALTER TABLE <table_name>DROP FOREIGN KEY <nameOfMyForeignKey>"and it gave this error:"Incorrect syntax near the keyword 'FOREIGN'."Same deal with the 2nd example. (everything is spelled properly, by the way, so I'm not sure why I keep getting errors: the syntax looks correct.)
amanda
@OMG Ponies: thanks for pointing out my mistake, and not down-voting either!
JohnB
amanda