Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Renaming Fields

Hi Community,

I wanted to rename field with out disturbing script part.

ex:

Right now script like below:

Table:

LOAD *

FROM Table;

actual fields for ex:

Column1, column2

now I should use * but need to change Column1 as Dim1

1 Solution

Accepted Solutions
ahmar811
Creator III
Creator III

try this

Alias Column1 as Dim1;

Table:

LOAD *

FROM Table;

hope it will help you

View solution in original post

3 Replies
avinashelite

Using the Alias or Qualify Statement

The Load or Select (SQL) statement can be preceded by an Alias or Qualify statement. These two statements are similar, in that they “silently” rename the fields in the output of the Load or Select statement.

Example:

Alias ID as CustomerID;

Load * from Customer.csv;

However, a consequence of using the Alias or Qualify statement is that you cannot use a resident load that refers to an original field name – instead it must refer to the field name as defined in the Alias or Qualify statement. This is sometimes confusing – especially if the Alias or Qualify statement is written earlier in the script, far from the Load statement. The Alias or Qualify statement will make your script harder to understand for other developers.

Using the Rename Fields Statement

This is a very good method if you want to rename all or some fields at the end of the script run. The best way is to use a mapping table with the old and new field names and use this as follows.

Example:

FieldNameMap;

Mapping Load OldFieldName, NewFieldName From FieldNames ;

Rename Fields using FieldNameMap;

You can store the mapping table in your database or in an Excel sheet so that it is easier to maintain.

A good solution may be to use a combination of using the as specifier and using the Rename fields statement. The as qualifier is used to define the data model, and the Rename fields statement to make the fields user-friendly. See Rename Field and Mapping for more information.

Anonymous
Not applicable

after your script insert:

rename field Column1 to Dim1;

that should do what you want

ahmar811
Creator III
Creator III

try this

Alias Column1 as Dim1;

Table:

LOAD *

FROM Table;

hope it will help you