Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out the Constraint Name?

Status
Not open for further replies.

lxn

Programmer
Jan 29, 2002
53
CA
Hi, all.
I'm coding a DDL procedure to change some of the tables and some relationships of a existing database. To the primary key on one of the tables, I have to remove the relationship associated with it first. I'm trying to use the &quot;ALTER TABLE <tablename> DROP CONSTRAINT <indexname>&quot; to get rid of the relationship. But since the relationship was created manually using MS Access, I don't know what the indexname is. Is there a way to find out the indexname? Or is there another way to do this whole thing? PLEASE HELP ME!!!

Thanks a lot.
 
Try this SQL the parameter Table Name? is the name of the table you want to drop the index from.

SELECT
szRelationship
FROM
msysrelationships
WHERE
szObject=[Table Name?] or
szReferencedObject=[Table Name?]
 
Hi, um yeah, thanks.
I'd already found that out from the Access Table and Relationship Forum. Don't remember who posted it, maybe it was you :)
Yeah, that works out perfectly, since I need the relation name to delete it using the Delete method in the Relations Collection.
So, um, thanks a lot for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top