у меня два стола.
table test1 { id int identity(1,1), name char(40) primary key } table test2 { id int primary, _test1 int }
Я хочу, чтобы _test1 был внешним ключом из Tbl test1 (id). но он имеет ошибку. Как я могу сделать id int test1 unique?
id
unique
Добавить уникальное ограничение на id в test1
test1
create table test1 ( id int identity unique, name char(40) primary key ) create table test2 ( id int primary key, _test1 int references test1(id) )