|
Oh, I see. Ignore the previous reply (except for the "good luck" part). When I try this (using a V5R3 box), it appears to work. That is, the tables create, I can insert rows into each table, and I cannot insert a row into entity_platform_categories if I do not have a row in entity_platforms with the correct key. --- "Goodbar, Loyd (ETS - Water Valley)" <LGoodbar@xxxxxxxxxxxxxx> wrote: > 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. > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
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.