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 2008 Forums
 Transact-SQL (2008)
 Create Reference to another database

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2009-04-24 : 12:26:50

I am trying to create a reference to another db on the same server.

I am getting the invalid table error when running the sql:

ALTER TABLE [dbo].[myTable] ADD CONSTRAINT FK_CreatorUserId
FOREIGN KEY (CreatorUserId) REFERENCES [ServerName].[ASPNET_Membership].[aspnet_Users] (UserId)
GO


Why can't it create a reference?

thanks,

Zath

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-04-25 : 04:32:23
Cross-database foreign key references are not supported.
Maybe you can solve problems by using triggers?

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -