UNIQUE CONSTRAINT on a column from foreign table in SQL Server 2008
Posted
by bodziec
on Stack Overflow
See other posts from Stack Overflow
or by bodziec
Published on 2010-06-12T23:03:51Z
Indexed on
2010/06/13
1:12 UTC
Read the original article
Hit count: 303
I have two tables:
create table [dbo].[Main]
(
[ID] [int] identity(1,1) primary key not null,
[Sign] [char](1) not null
)
create table [dbo].[Names]
(
[ID_Main][int] primary key not null,
[Name][nvarchar](128) not null,
constraint [FK_Main_Users] foreign key ([ID_Main]) references [dbo].[Main]([ID]),
constraint [CK_Name] unique ([Name], [Sign])
)
The problem is with the second constraint CK_Name Is there a way to make a constraint target column from a foreign table?
© Stack Overflow or respective owner