If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Deleting a foreign key relationship in SQL
How do you delete or drop a foreign key relationship from an Access
database, using SQL, when the foreign key relationship was created within Access so I do not know/have the name of the relationship? I have found the SQL to do this but you need the name of the foreign key relationship, which I don't have! ALTER TABLE Table2 DROP CONSTRAINT Relation1 How can I find out the name, or how can I delete the relationship without the name? Thanks, Stephen |
#2
|
|||
|
|||
It will usually be the name of the primary table concatenated with the
foreign table: Table1Table2 But here's how you can find out for su 1) Go to Tools Options from the Database Window 2) Click the System Objects checkbox in the View tab. You will now see the system tables 3) Look for a table called MSysRelationships and open it 4) The field called szRelationship holds the name 5) After you are done, uncheck the System Objects checkbox -- --Roger Carlson Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access questions in your Email? Free subscription: http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L "Stevio" wrote in message ... How do you delete or drop a foreign key relationship from an Access database, using SQL, when the foreign key relationship was created within Access so I do not know/have the name of the relationship? I have found the SQL to do this but you need the name of the foreign key relationship, which I don't have! ALTER TABLE Table2 DROP CONSTRAINT Relation1 How can I find out the name, or how can I delete the relationship without the name? Thanks, Stephen |
#3
|
|||
|
|||
Thanks Roger, I got it working thanks to your advice!
Stephen "Roger Carlson" wrote in message ... It will usually be the name of the primary table concatenated with the foreign table: Table1Table2 But here's how you can find out for su 1) Go to Tools Options from the Database Window 2) Click the System Objects checkbox in the View tab. You will now see the system tables 3) Look for a table called MSysRelationships and open it 4) The field called szRelationship holds the name 5) After you are done, uncheck the System Objects checkbox --Roger Carlson Access Database Samples: www.rogersaccesslibrary.com Want answers to your Access questions in your Email? Free subscription: http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L "Stevio" wrote in message ... How do you delete or drop a foreign key relationship from an Access database, using SQL, when the foreign key relationship was created within Access so I do not know/have the name of the relationship? I have found the SQL to do this but you need the name of the foreign key relationship, which I don't have! ALTER TABLE Table2 DROP CONSTRAINT Relation1 How can I find out the name, or how can I delete the relationship without the name? Thanks, Stephen |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table Wizard Does Not Set Relationship if Foreign Key and Primary Key Name Do Not Match Exactly in Case. | HDW | Database Design | 3 | October 16th, 2004 03:42 AM |
Function isn't available in expressions in query expression | Reiner Harmgardt | General Discussion | 4 | July 21st, 2004 09:30 AM |