Question : Visio - Fixing various errors for Forward Engineering

I am trying to convert a Visio 2007 file to a SQL Server database, but keep running into various issues.

Since there is no Forward Engineering in Visio 2007 / 2010 (I have 2010 Premium installed), I saved the file as 2002/2003 Visio file and opened it in Enterprise Architect (in a Virtual Machine). I am getting various errors that I am trying to track down.

One of the issues seems straightforward and could just be the way the old Visio works.

I simplified the diagram to 2 tables and a few fields. See attached. In the older version, I get an error:

DATABASESTRUCTURETEST.VSD : error L3020: 'tblPerson_tblTest_FK1' : Foreign key relationship has same parent and child tables as tblPerson_tblTest_FK2, but does not have different forward and inverse verb phrases.

Here is code to create the tables manually in SQL

Well, that is true, but they are pointing to different relationships. If I have a CheckedOutBy field which will hold a PersonID, and it must exist in the Person table, this is the same relationship for the CheckedInBy field, and could easily be a different PersonID, but still needs to have the same relationship. So, how do I fix this error?

Also in the attached file, I cannot figure out how to remove the background sheet. I try to delete it, but it says "you must remove v_background1 from the background list of 'Test' before you can delete it.

Okay, fine... where?

I am in process of cleaning up the file so I can use the Forward Engineering add-in from here http://www.sqlbi.com/Default.aspx?tabid=173


 
 
Simple Relationship
329055
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
CREATE TABLE [tblPerson](
	[PersonID] [int] IDENTITY(1,1) NOT NULL,
	[EmpCode] [varchar](5) NULL,
	[LoginName] [varchar](50) NULL,
 CONSTRAINT [PK_tblPerson] PRIMARY KEY CLUSTERED 
(
	[PersonID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [tblTest](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Something] [varchar](50) NULL,
	[CheckedInBy] [int] NULL,
	[CheckedOutBy] [int] NULL,
 CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [tblTest]  WITH CHECK ADD  CONSTRAINT [FK_tblTest_tblPerson_CheckIn] FOREIGN KEY([CheckedInBy])
REFERENCES [tblPerson] ([PersonID])
GO
ALTER TABLE [tblTest] CHECK CONSTRAINT [FK_tblTest_tblPerson_CheckIn]
GO
ALTER TABLE [tblTest]  WITH CHECK ADD  CONSTRAINT [FK_tblTest_tblPerson_CheckOut] FOREIGN KEY([CheckedOutBy])
REFERENCES [tblPerson] ([PersonID])
GO
ALTER TABLE [tblTest] CHECK CONSTRAINT [FK_tblTest_tblPerson_CheckOut]
GO

Answer : Visio - Fixing various errors for Forward Engineering

Okay, I solved my own problem, but rather than delete the question, I will leave it in case someone else runs into this issue. If the moderators want to delete it, that is fine too.

Both relations had the word "has". If I change it to hasFK_tblTest_tblPerson_CheckOut and hasFK_tblTest_tblPerson_CheckIn, it works fine. Basically, I just did a reverse engineer on the tables I created in SQL Server and compared it to my sample posted.
Random Solutions  
 
programming4us programming4us