MS SQL一对一关系 [英] MS SQL One to one relationship

查看:112
本文介绍了MS SQL一对一关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个具有一对一关系的表.
我希望第二个表在输入并提交第一个表时具有相同的ID.
怎么做?预先感谢.

I have two tables with one to one relationship.
I want second table to have the same id when the first one is entered and committed.
How to do that? Thanks in advance.

推荐答案

Valentine_Kiev写道:
Valentine_Kiev wrote:

我希望第二张桌子有输入和提交第一个ID时使用相同的ID.

I want second table to have the same id when the first one is entered and committed.



在第一个表中输入一个条目时,使用 TRIGGER 将该值输入第二个表中.



Use TRIGGER to enter the value in 2nd table when an entry is entered in first one.


有一个after触发器可以解决这个问题,对吧?
但是我应该如何获取在第一个表中输入的值?
There is an after trigger to deal with that, right?
But how am I supposed to get the value which is entered in first table?


这篇关于MS SQL一对一关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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