For those
of you who use Visio to due your database modeling, you might have run across
the slight problem of not being able to get rid of the auto-generated
foreign-keys in your tables (assuming you might have deleted and recreated a
relation to the same table.) If you try to generate a database from your
model, you’ll find that the foreign keys that you thought you deleted
still exist somewhere in ‘limbo’ and as a result, the error
checking in Visio goes crazy.
So, how do
you get rid of these ‘phantom foreign keys/relationships’? Well, I
found no solutions from Microsoft’s web site, but I did find some
work-arounds from a few blog posts. Here are two methods that seem to work:
Copy
Data Structure into a New File
- Create a
new database model diagram
- Select
all of the items in your existing diagram and click Ctrl+C (Copy)
- Paste the
entire diagram into your new diagram. The “phantom” foreign
keys will not be copied.
View
(and Delete) Related Tables
- Right-click
on the table with the problem
- Select
"Show related tables" and you should get the "phantom
relationship" back
- Select
the relationship and delete it