× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Loyd,

These statements run fine for me in Run SQL Scripts in iSeries Navigator at
V5R3.

Which release of the OS are you on?

How are you running the statements (i.e. what do you mean by "compile")?

You do have a GUI available for defining tables, indexes, views,
constraints, triggers, aliases etc. etc. in iSeries Navigator - so you can
get back to spoiling yourself :-)

HTH

Paul

----- Original Message -----
From: "Goodbar, Loyd (ETS - Water Valley)" <LGoodbar@xxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Thursday, July 28, 2005 11:06 PM
Subject: SQL foreign key question


> I'm trying to create some test SQL tables with foreign key relationships.
I
> have a table entity_platforms defined as
>
>
>
> create table lg/entity_platforms
>
>  (
>
>     abbreviation for column abbr char(5) not null with default,
>
>     platform varchar(100) not null with default,
>
>     primary key(abbreviation)
>
> );
>
>
>
> And want to define a table entity_platform_categories as
>
>
>
> create table lg/entity_platform_categories
>
> (
>
>     abbreviation for column abbr char(10) not null with default,
>
>     category varchar(100) not null with default,
>
>     platform_abbreviation for column platabbr char(5) not null with
default,
>
>     primary key(abbreviation),
>
>     constraint platform_abbreviation_fk
>
>          foreign key (platform_abbreviation)
>
>          references lg/entity_platforms (abbreviation)
>
>          on delete no action
>
>          on update no action
>
> );
>
>
>
> When I compile the entity_platform_categories table, I get error SQL0538:
> Position 1 The FOREIGN key in constraint PLATFORM_ABBREVIATION_FK in LG
not
> same as the parent key.
>
>
>
> According to the SQL manual, I'm saying that platform_abbreviation in
> entity_platform_categories is a foreign key pointing to the abbreviation
> column in the entity_platforms table. Is this correct?
>
>
>
> (I know, SQL server with the GUI spoiled me.)
>
>
>
> TIA,
>
> Loyd
>
>
>
> Loyd Goodbar
>
> Senior programmer/analyst
>
> BorgWarner
>
> E/TS Water Valley
>
> 662-473-5713
>
>
>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.