Duplicate Fields Naming Differs in Local and Remote View

Last reviewed: May 7, 1996
Article ID: Q150551
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b

SUMMARY

When you're using the local or remote view designers to create views with multiple tables, note that duplicate field names in the output fields list are not the same in a local view versus a remote view.

MORE INFORMATION

In a local view, when you add duplicate field names to the output field list, the fields are renamed by adding the underscore character (_) followed by a sequential alpha character.

For example, if a field named Cust_ID is added to the output fields list of a local view more than once, the first occurrence of this field is renamed to Cust_ID_a, and the second occurrence is renamed to Cust_ID_b.

In a remote view, the duplicate fields are renamed by adding a sequential number to the second and all subsequent occurrences of the field name. For example, if a field named Cust_ID is added to the output fields list of a remote view more than once, the first occurrence of this field is named Cust_ID, and the second occurrence is renamed to Cust_ID1.

This is the default behavior of the local and remote view designers and cannot be changed by the user. The only way to control the renaming of duplicate fields in a view is to create the view programmatically using the CREATE SQL VIEW command. When you create the views programmatically, the fields can be renamed using the AS clause of the SQL SELECT command.

The following example creates a remote view named View1 on two tables named TBL1 and TBL2. Both tables contain a field named Cust_ID. This remote view renames the duplicate fields to Cust_ID_a and Cust_ID_b.

   CREATE SQL VIEW View1 REMOTE CONNECTION MyConnection AS SELECT ;
          TBL1.Cust_ID AS Cust_ID_a, TBL2.Cust_ID AS Cust_ID_b    ;
          FROM TBL1, TBL2

NOTE: If this remote view is later modified by using the remote view designer and then saved, the fields are renamed to the remote view designer's defaults of Cust_ID and Cust_ID1.


Additional reference words: 3.00 3.00b VFoxWin ODBC
KBCategory: kbtool
KBSubcategory: FxtoolAccessory



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 7, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.