SQL field reference

SQL field reference

Post by Steve Schmid » Thu, 19 Apr 2001 21:25:51

I've been experimenting with creating files (tables) by using SQL and have
been able to duplicate most of the functionality of a DDS physical file
definition except for referencing a field in one table to another.

For example, we have a physical file, XXREF, where system-wide fields are


NAME        20A

In file CUSTOMER we have:

CUSNAM                  REF(NAME)
ADDR1                      REF(ADDRESS)
ADDR2                      REF(ADDRESS)

How do I duplicate this functionality in SQL? Or should I be thinking along
some new model design?



SQL field reference

Post by Rolf Mitta » Thu, 19 Apr 2001 21:54:23

SQL does not support the concept of field referenece.

You can however accomplish similar behaviour with
user defined data types :

"create distinct type nameType as char (20)"

"create table customer (custName nameType)"

HTH Rolf

Dipl.Inf.(FH) Rolf P Mittag
IBM Partner in Development
Leipziger Str. 50
D-69214 Eppelheim
Fon: +49 (6221) 76 78 60
Fax: +49 (6221) 76 80 26


SQL field reference

Post by Kent Milliga » Sat, 21 Apr 2001 07:39:39

Improving the SQL support in this area is something that we are working on...

Kent Milligan, DB2 & BI team
PartnerWorld for Developers, iSeries

(opinions stated are not necessarily those of my employer)