Foreign keys referencing local alias'

Henrik Sorensen

Foreign keys referencing local alias'
Dear list,

On DB2 V7 - OS/390.

When reading the manuals it seems almost too good to be true.
It should be possible to create a foreign key that references a local
alias.

The reason for doing this is to prevent that the FK gets dropped when the
real referenced table is dropped.

Pseudo ddl:

create table A . tb1 (code integer, string char(80));
create alias B. tb1 for A.tb1 ;

create table b.tb2 (a integer) ,
foreign key(a) references B.tb1 ( code ) on delete restrict ;


Are there any reasons as to why it should not work ?

And are there any concerns if the structure of the referenced tables
changes ?


Thanks for any hints or comments
Henrik


This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended recipient,
please delete this message and notify the sender

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

laura miller

Re: Foreign keys referencing local alias'
(in response to Henrik Sorensen)
I will be out of the office until Friday December 10. I will respond
to your message as soon as possible when I return. If you need
immediate assistance, please contact either Bill Boyd or the Help Desk.



>>> DB2-L 12/09/04 06:04 >>>

Dear list,

On DB2 V7 - OS/390.

When reading the manuals it seems almost too good to be true.
It should be possible to create a foreign key that references a local
alias.

The reason for doing this is to prevent that the FK gets dropped when
the
real referenced table is dropped.

Pseudo ddl:

create table A . tb1 (code integer, string char(80));
create alias B. tb1 for A.tb1 ;

create table b.tb2 (a integer) ,
foreign key(a) references B.tb1 ( code ) on delete restrict ;


Are there any reasons as to why it should not work ?

And are there any concerns if the structure of the referenced tables
changes ?


Thanks for any hints or comments
Henrik


This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended
recipient,
please delete this message and notify the sender

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and
home page at http://www.idugdb2-l.org/archives/db2-l.html. From that
page select "Join or Leave the list". The IDUG DB2-L FAQ is at
http://www.idugdb2-l.org. The IDUG List Admins can be reached at
[login to unmask email] Find out the latest on IDUG conferences
at http://conferences.idug.org/index.cfm

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

laura miller

Re: Foreign keys referencing local alias'
(in response to laura miller)
I will be out of the office until Friday December 10. I will respond
to your message as soon as possible when I return. If you need
immediate assistance, please contact either Bill Boyd or the Help Desk.



>>> DB2-L 12/09/04 06:04 >>>

Dear list,

On DB2 V7 - OS/390.

When reading the manuals it seems almost too good to be true.
It should be possible to create a foreign key that references a local
alias.

The reason for doing this is to prevent that the FK gets dropped when
the
real referenced table is dropped.

Pseudo ddl:

create table A . tb1 (code integer, string char(80));
create alias B. tb1 for A.tb1 ;

create table b.tb2 (a integer) ,
foreign key(a) references B.tb1 ( code ) on delete restrict ;


Are there any reasons as to why it should not work ?

And are there any concerns if the structure of the referenced tables
changes ?


Thanks for any hints or comments
Henrik


This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended
recipient,
please delete this message and notify the sender

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and
home page at http://www.idugdb2-l.org/archives/db2-l.html. From that
page select "Join or Leave the list". The IDUG DB2-L FAQ is at
http://www.idugdb2-l.org. The IDUG List Admins can be reached at
[login to unmask email] Find out the latest on IDUG conferences
at http://conferences.idug.org/index.cfm

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm


This e-mail transmission contains information that is confidential and may be privileged. It is intended only for the addressee(s) named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm