Error in select query

Hello all,

I am getting an error in query.

I have a table and i want to create a select query and get the output in another table.

  1. I have created “premiums_assured” table
  2. Created the assign activity with select query
    3)Get error about as operator

image

Any advice?

@the.christopoulos I guess you need to use Single Quotes instead of for CUSTOMER CODE NUMBER

@supermanPunch I again get the same error.

I used as you said :blush:
image

@the.christopoulos Can you try below query once

premium_assured .Select(“[CLIENTNO] in (‘CUSTOMER CODE NUMBER’)”).CopyToDataTable()

@indra After using the query you said i get this error :

image

@the.christopoulos Can you tell us what you want to Achieve by that Select Query ?

@supermanPunch I want to get only specific columns of the table but rename them also by using as operand.

Is there any other way to achieve the above? To get specific column and rename it also ?

@the.christopoulos There is a way in my mind, but it’s not so good :sweat_smile: , Can you send the Excel File and Tell me the Columns you need to Change

I attach you the excel.

The columns I want to rename are the yellow ones.

test.xlsx (11.8 KB)

@the.christopoulos What do you want to rename it too?

@the.christopoulos

Yes you can achieve.

    Assign Dt = DT.DefaultView.ToTable(False,"CLIENTNO","PADEATH","PADEATH_NET","PADISABILITY")

Above query is used to select columns in the datatable

Below is used rename column

    Assign DT.Columns(“CLIENTNO”).ColumnName = "CUSTOMER CODE NUMBER"
  
    Assign DT.Columns(“PADEATH”).ColumnName = "RENAME PADEATH"

    Assign DT.Columns(“PADEATH_NET”).ColumnName = "RENAME PADEATH_NET"

    Assign DT.Columns(“PADISABILITY”).ColumnName = "RENAME PADISABILITY"

Try this and let me know.

Hi
To rename the column first read the excel data with Read range activity and get the output with a variable of type datatable named dt
—now use a ASSIGN activity like this
dt.Columns(“yourcolumnname”).ColumnName = “new ColumnName”

Cheers @the.christopoulos

@indra so I can not select and rename in the same select?

The as operand does not work?

@the.christopoulos

I guess no.

So guys @Palaniyappan @supermanPunch @indra

I have to do this in two activities and not in one select query where I select and rename column also?

@the.christopoulos Most Probably :sweat_smile:

@the.christopoulos Check this Workflow, this I had done the day you asked this question, Hope it helps :sweat_smile:
RenameColumnNames.zip (10.8 KB)