Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

INFO: Duplicate Fields Naming Differs in Local and Remote View


View products that this article applies to.

This article was previously published under Q150551

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB150551, kbinfo

↑ Back to the top

Article Info
Article ID : 150551
Revision : 4
Created on : 10/15/2003
Published on : 10/15/2003
Exists online : False
Views : 518