Quantcast
Channel: SQL Server Data Warehousing forum
Viewing all articles
Browse latest Browse all 1203

How foreign key references two more tables?

$
0
0

Hi

      I have created 3 tables with primary keys.

create table dbo.test_index(id int identity(1,1) not null , name varchar(255) Constraint Pk_Ind_Id primary key(id) )
create table dbo.Test_Const (id int identity(100,1)not null ,name varchar(50) Constraint Pk_Id primary key(id))
create table dbo.test_key(kid int identity(1,1) not null ,id int,kname varchar(255) Constraint Pk_key_Id primary key(kid) )

Now i want to refer the column'id' in table'dbo.test_index' and also the column'id' in table'dbo.Test_Const'  as foreign key for the table'dbo.test_key' column'id'.

Can any one assist me how is it possible with example?

Thanks in advance.

SathyJay



Viewing all articles
Browse latest Browse all 1203


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>