UNIQUE CONSTRAINT on a column from foreign table in MSSQL2008
- by bodziec
Hi,
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?