Wednesday, March 28, 2012

How to enforce integrity across databases

I would like to enforce integrity across two databases on the same server. A
s
far as I know there is no way to create a FK constraint pointing to another
database. So my options are either a trigger (which I would like avoid) or a
check constraint.
Does anyone have any expericence/recommendations they can share on how to
implement this?Using triggers.
AMB
"DBA72" wrote:

> I would like to enforce integrity across two databases on the same server.
As
> far as I know there is no way to create a FK constraint pointing to anothe
r
> database. So my options are either a trigger (which I would like avoid) or
a
> check constraint.
> Does anyone have any expericence/recommendations they can share on how to
> implement this?|||"DBA72" <DBA72@.discussions.microsoft.com> wrote in message
news:27E1F221-1355-447A-B052-542680E9DD5F@.microsoft.com...
> I would like to enforce integrity across two databases on the same server.
As
> far as I know there is no way to create a FK constraint pointing to
another
> database. So my options are either a trigger (which I would like avoid) or
a
> check constraint.
> Does anyone have any expericence/recommendations they can share on how to
> implement this?
IIRC, CHECK constraints cannot reference outside their table, so you are
left with triggers, or data validation at the stored proc level.
I would suggest triggers in this case.
Rick Sawtell

No comments:

Post a Comment