[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5157
  • Last Modified:

Error: Relationship must be on the same number of fields with the same data types


I am trying to create referential integrity between two tables. (One-To-Many Relationship)
One table has a primary key - DocID
The other table has the same field - DocID.
Both data types are NUMBER.
Why does it keep giving me this error??? It's so frustrating!!!

  • 2
1 Solution
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Numer - What?  Integer, Long Integer, Currency, ...   they must match

Also, if your checking the referential integrity checkbox, then the existing data must comply with that relationship.
If you have a number in the 'many' table that is not in the 'one' table, then you'll have to resolve that before you can establish referential integrity.
jenica024Author Commented:
You're absolutely right.
Sorry. I forgot to check the type of number it is.
Got so many things going on. :)

Thanks loads!
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the grade.  Good luck with your project. -Jim

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now