如何给出这些表的原键关系 [英] how to give the forigen key relation these tables

查看:92
本文介绍了如何给出这些表的原键关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与现有的主键或唯一约束不匹配.

我创建了两个表,一个是emp,第二个表是收入表

emp表emp_id如何给出原键参考收入表

don''t match with existing primary key or unique constraint.

i created two tables one is emp and second table is income table

emp table emp_id how to give forigen key reference income table

推荐答案


主键和外键必须具有相同的数据类型.
检查这篇文章
http://www.functionx.com/sqlserver2000/Lesson11.htm [ http://msdn.microsoft.com/en-us/library/ms189049.aspx [ ^ ]
最好的问候
M.Mitwalli
Hi ,
Both keys primary and foreign key have to be same data type .
Check this Article
http://www.functionx.com/sqlserver2000/Lesson11.htm[^]
http://msdn.microsoft.com/en-us/library/ms189049.aspx[^]
Best Regards
M.Mitwalli


您有两个表共有的字段吗?

例如

emp表和收入表中的emp_id.然后,您可以将emp_id用作外键.
do you got any field common to both table?

for example

emp_id in both emp table and income table. Then you can use emp_id as foreign key.


这篇关于如何给出这些表的原键关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆