当我在主键表中插入时,我想在外键表中插入外键值. [英] I want to insert foreign key value in foreign key table when i insert in primary key table.

查看:193
本文介绍了当我在主键表中插入时,我想在外键表中插入外键值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如表Patient(P_id,P_Name,P_age)
另一个表的约会(App_No,P_id,App_date)
当我在患者表中插入值时
我也试图在约会表中插入P_id.但是它引发了一个异常,即App_No不能为空.
请帮帮我.

for eg table Patient(P_id,P_Name,P_age)
another table Appointment(App_No,P_id,App_date)
when i am inserting values in Patient Table
I am trying to insert P_id in appointment table also . But it is throwing an exception that it App_No cannot be left empty.
Please Help me out.

推荐答案

将App_No设置为身份字段.请阅读 [
Set App_No as an Indentity field. Please read this[^].


这篇关于当我在主键表中插入时,我想在外键表中插入外键值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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