|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Simple Realtionship Problem
hi evry1, i hope someone can help me with this simple database relationship problem:
i am trying to link 2 tables lets call them A and B. I am creating a relationship between the two tables (with enforced referential integrity) but i get the error message 'Relationship must be on the same number of fields with the same data types'. I know that the data types between the two attributes i am joining are different this is why the error is occuring, so to avoid it you would abviously make sure that they are the same data type, but i cannot change the data type due to user requirements. So how do i get around this error message? or is it impossible? your help is greatly appreciated, regards, ThaGeza |
|
#2
|
|||
|
|||
|
What data types are the PK in one table and the FK in the other table? If I have a PK set as integer in my table and I want to link that to another table as a FK, I need to make sure that it is set to integer as well for when you start to store the data you can't save an integer into a field that is set as a String or date.
Later, David Somers |
|
#3
|
|||
|
|||
|
Yes they have to be the same
What is your user requirements that makes you thingk you need them different. Mayben we can ehlp you get around this and still met your user requirements. S- |
|
#4
|
|||
|
|||
|
The PK is of datatype 'Long integer' and the FK is 'integer'.
Is there any method to cast one into the other, or something like that. Or does a 'link' table need to be made? such as A_B if you see what i mean. The user requirement states clearly that the attribute needs to be of type long integer in one table and of type integer in another table. maybe they forgot to add the word 'long' in the second sentence, i will have to make sure. cheers, Geza |
|
#5
|
|||
|
|||
|
their user requirements are wrong by default. It doesn't matter what DB you were to create this in the field type, by design and by theory are the same or a relationship can't exist. Just change it. They won't even know and if they do notice, then tell them that their specs were inacurate and that it wouldn't work they way they specified.
S- |
|
#6
|
|||
|
|||
|
i found out it was an error in the user requirements, the primary key and the foreign key are meant to be the same data type, thus the error does not occur anymore.
thanks for the help people, ThaGeza |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Simple Realtionship Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|