| Author |
Define FK over DB boundaries
|
|
| Christian Havel 2006-01-13, 7:23 am |
| Hi,
is it possible to assign a foreign key from DB1 to a primary key from DB2?
Thanks
Christian
| |
|
| Nope, it's not supported. You'd have to do it with triggers.
--
HTH. Ryan
"Christian Havel" < ChristianHavel@discu
ssions.microsoft.com> wrote in
message news:0FB2E334-A203-4BAF-BDA1- 71A4462E8841@microso
ft.com...
> Hi,
>
> is it possible to assign a foreign key from DB1 to a primary key from DB2?
>
> Thanks
> Christian
| |
|
| No, you have to implemt that with triggers.
BTW: Do not cross(-language) post.
HTH, jens Suessmeyer.
| |
| John Bell 2006-01-13, 9:23 am |
| Hi
You could add a check constraint that calls a function, but this is likely
to be very slow.
John
"Christian Havel" wrote:
> Hi,
>
> is it possible to assign a foreign key from DB1 to a primary key from DB2?
>
> Thanks
> Christian
| |
| Scott Morris 2006-01-13, 9:23 am |
| > You could add a check constraint that calls a function, but this is likely
> to be very slow.
Careful with this - real DRI works in two directions. This would only work
in one direction and only for inserts and updates.
| |
| John Bell 2006-01-13, 9:23 am |
| Scott
Both the trigger solution and the check constraint require changes to both
databases if you want to cover everything.
John
"Scott Morris" wrote:
>
> Careful with this - real DRI works in two directions. This would only work
> in one direction and only for inserts and updates.
>
>
>
| |
| Scott Morris 2006-01-13, 11:23 am |
| > Both the trigger solution and the check constraint require changes to both
> databases if you want to cover everything.
Nothing I wrote disagreed with this. But, as I mentioned, a check
constraint is not checked during deletion. A set of triggers, when properly
designed and written, can enforce the required relationship. As far as I
know, check constraints cannot wholely support the requirement.
|
|
|
|