Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Foreign Key Table Constraints

Author  Topic 

AK
Starting Member

27 Posts

Posted - 2002-07-29 : 10:33:34

I'm having a problem setting up a table constraint:

create table model (
sdate varchar(10),
c_type varchar(20),
p_type char(5),
o_type char(5),
group_order smallint,
co_type char(1),
name varchar(20)
constraint fk_Dictionary_matrix_selection_model foreign key (s_date,c_type,p_type,o_type,group_order)
references matrix
(s_date,c_type,p_type,o_type,group_order)
)

I'm getting the error: 'More than one key specified in column level FOREIGN KEY constraint'

but there doesn't seem to be a way to specify that you want a table constraint rather than a column constraint...

please help

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-29 : 10:36:44
try this..

create table model (
sdate varchar(10),
c_type varchar(20),
p_type char(5),
o_type char(5),
group_order smallint,
co_type char(1),
name varchar(20),
constraint fk_Dictionary_matrix_selection_model foreign key (s_date,c_type,p_type,o_type,group_order)
references matrix
(s_date,c_type,p_type,o_type,group_order)
)

 


Jay White
{0}
Go to Top of Page

AK
Starting Member

27 Posts

Posted - 2002-07-29 : 10:42:21
Thanks

Is it just me or does everyone find SQL help syntax about as easy to decipher as Linear B!

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-29 : 10:49:16
It's no worse than any other help file syntax, and A LOT better than most, especially Oracle documentation.

There's always the example statements at the end, they usually cover all of the high points.

Go to Top of Page
   

- Advertisement -