P
Paul Benati
We have three tables:
* Companies
* Addresses
* CompanyAddresses
CompanyAddresses contains a CompanyId, AddressId, and Role. Role defines the
type of address (such as Billing or Shipping). I am trying to setup a
relationship in the XML Schema Designer in VS.NET so that rows from the
Addresses table can be retrieved based on the AddressId in the
CompanyAddresses table. The AddressId column in the CompanyAddresses table
is *intentionally* not constrained to be unique.
Here is the issue:
When we try to setup a CompanyAddresses.AddressId to Addresses.AddressId
relationship, the designer constrains the CompanyAddresses.AddressId column
to be unique (which we do not want it to be). We have taken an alternative
approach by creating a composite key on the CompanyAddresses table then
linking only the CompanyAddresses.AddressId to the Addresses table, however
the designer will not allow this.
So my question is; how do I define a relationship in which the column in the
master table is not unique?
Example Data:
A row from the Companies Table:
CompanyId | Name
------------------------
1 | Test Company
Addresses Table:
AddressId | AddressText
-----------------------
1 | 1215 Hightower Trail...
2 | 2546 Stonington RD...
CompanyAddresses Table:
CompanyId | AddressId | Role
----------------------------
1 | 1 | Primary
1 | 1 | Billing
1 | 2 | California Division
Hope you can help!
Thanks -
--
Paul Benati, MCP ASP.NET
VP Development
Advanced Productivity Software, Inc.
(770) 998 - 9698 x101
* Companies
* Addresses
* CompanyAddresses
CompanyAddresses contains a CompanyId, AddressId, and Role. Role defines the
type of address (such as Billing or Shipping). I am trying to setup a
relationship in the XML Schema Designer in VS.NET so that rows from the
Addresses table can be retrieved based on the AddressId in the
CompanyAddresses table. The AddressId column in the CompanyAddresses table
is *intentionally* not constrained to be unique.
Here is the issue:
When we try to setup a CompanyAddresses.AddressId to Addresses.AddressId
relationship, the designer constrains the CompanyAddresses.AddressId column
to be unique (which we do not want it to be). We have taken an alternative
approach by creating a composite key on the CompanyAddresses table then
linking only the CompanyAddresses.AddressId to the Addresses table, however
the designer will not allow this.
So my question is; how do I define a relationship in which the column in the
master table is not unique?
Example Data:
A row from the Companies Table:
CompanyId | Name
------------------------
1 | Test Company
Addresses Table:
AddressId | AddressText
-----------------------
1 | 1215 Hightower Trail...
2 | 2546 Stonington RD...
CompanyAddresses Table:
CompanyId | AddressId | Role
----------------------------
1 | 1 | Primary
1 | 1 | Billing
1 | 2 | California Division
Hope you can help!
Thanks -
--
Paul Benati, MCP ASP.NET
VP Development
Advanced Productivity Software, Inc.
(770) 998 - 9698 x101