sql server - How to create a reference key from given details -


create table test1 (     id bigint not null,     name varchar(10) not null     constraint pk_test primary key(id,name) ) create table test2 (     mid bigint not null references test1(id) ,     msalary varchar(10) not null ) 

in test2 not able create reference test1 id please me.. in advance!!!!

you need foreign key in order reference table. try this:

create table test1 (     id bigint not null primary key,     name varchat(10) not null )  create table test2 (     mid bigint not null,     msalary varchar(10) not null,     foreign key (mid) references test1(id) ) 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -