473,503 Members | 7,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple constraint for foreign keys in ms access

1 New Member
Hi,

I would like to form a table which needs to be connected with 2 other tables. I need to create 2 foreign keys for them. But there is an error pop out saying "There is an relationship named 'Avatar_fk' in the table". Did I make any mistake in the following SQL.

Expand|Select|Wrap|Line Numbers
  1. Create table Avatar 
  2. (
  3.     AvatarID varchar(100) NOT NULL,
  4.     AvatarName varchar(100),
  5.     Gender char(1),
  6.     DOB date,
  7.     AvatarStrengthIndicator int,
  8.     Hoard int,
  9.     SpeciesID varchar(100),
  10.     PlayerID varchar(100),
  11. Constraint Avatar_pk PRIMARY KEY (AvatarID),
  12. Constraint Avatar_fk FOREIGN KEY (PlayerID) REFERENCES Player (PlayerID)
  13. Constraint Avatar_fk FOREIGN KEY (SpeciesID) REFERENCES Species (SpeciesID)
  14. );
Mar 17 '13 #1
1 1550
zmbd
5,501 Recognized Expert Moderator Expert
The construct you are using is incorrect by calling the constraint a second time using the same name.

This is the reference for SQL:
> CONSTRAINT Clause (Microsoft Access SQL)(OFFICE 2007)
There is an example there for multiple field constraint.
Mar 17 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1824
by: Rainer Collet | last post by:
Hi! I have a question how to solve the folloing task: I have 2 tables referencing each over: An user table and an address table. Each user has one or no address. If an user is dropped the...
1
2981
by: Vinodh Kumar P | last post by:
I understand the number of foreign keys allowed is restricted by the DBMS I use. In a general relational schema design perspective how many foreign keys a table shall have? If I have large number...
26
14078
by: pb648174 | last post by:
I have a table called BidItem which has another table called BidAddendum related to it by foreign key. I have another table called BidFolder which is related to both BidItem and BidAddendum, based...
0
1736
by: unreal4u | last post by:
hi everybody .. first post ... hope someone answers it ... Well .. this is my problem ... I got 2 tables: /*==============================================================*/ /* Table:...
3
1921
by: Thomas LeBlanc | last post by:
I am able to enter a null in a foreign key field in one table(table2) without the foreign key relationship (table1.t1_id) validating the value. Why is this? Below are 2 table's scripts: ...
9
3891
by: sonal | last post by:
Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... In short we take up various comma separated data files for...
6
9719
by: Ivan | last post by:
Hello to all and thanks for answer to my topics. I made one stored procedure that delete one table, but when call/execute the procedure this show SQL0532N A parent row cannot be deleted...
6
14282
by: ravichoudhari | last post by:
i came accross requirement of multiple foreign keys in a table referencing the same primary key another table. i created the table relations using the relations editor in access. even though i...
1
10979
by: apax999 | last post by:
Kinda new to SQL, using SQL Server 2005. I have some foreign keys in a couple of tables. I need to drop these tables, but can't since I'll get the error: Msg 3726, Level 16, State 1, Line...
6
5891
by: bobdurie | last post by:
If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? I've been told this is done in some databases, but i need to know for sure if SQL...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.