Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 need help!

Author  Topic 

my_aro
Yak Posting Veteran

50 Posts

Posted - 2005-09-01 : 23:31:03
hey i got a problem with setting a foriegn key referencing from a table of a database to another table of another database.. what actually comes out is that there is a Cross-database foreign key referencing error. is ther anyway that i can solve the problem? i tried doing this

USE master
EXEC sp_configure 'Cross DB Ownership Chaining', '0'; RECONFIGURE
EXEC sp_dboption 'core', 'db chaining', 'ON'
EXEC sp_dboption 'productiona', 'db chaining', 'ON'

and tried to run my script:

CREATE TABLE [productiona].[dbo].[raw_inventory](
[id] [bigint] NOT NULL
,[flt_qty] [float] NOT NULL
,[lng_uom_id] [bigint] NOT NULL
CONSTRAINT [FK_rawinventory_id_rawmaterial_id] FOREIGN KEY([id])
REFERENCES [productiona].[dbo].[raw_material]([id])
,CONSTRAINT [FK_rawinventory_uomid] FOREIGN KEY ([lng_uom_id])
REFERENCES [core].[dbo].[uom_data]([id])
)ON [PRIMARY]

but still this

CONSTRAINT [FK_rawinventory_uomid] FOREIGN KEY ([lng_uom_id])
REFERENCES [core].[dbo].[uom_data]([id])

gives me the "Cross-database foreign key reference error not supported"

what could be the possible solution for this?

Kristen
Test

22859 Posts

Posted - 2005-09-02 : 02:49:07
Hi my_aro, Welcome to SQL Team!

You could write a trigger that enforced the foreign key - but that's probably not what you want to hear!

Kristen
Go to Top of Page
   

- Advertisement -