Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL alias for tables in QlikView

Hi guys,

I am trying to dig into SQL a little bit, and I have noticed, that when I try to name a table in QlikView, using only SQL, then it doesn't rename the chosen table. My code for this is:

Select *

From FilteredAccount as Partners;

FilteredAccount is the table I want to query, and I want to rename it to Partners. But after Reloading, both in the UI (by creating table box) and in the table viewer, I see FilteredAccount as table name. Has anyone encountered this before?

Thanks for the answers!

BR

T

13 Replies
mjm
Employee
Employee

Hello Tibor,

you can rename the table from within the load script as per the example below:

CustomersTable:

LOAD CustomerID,

    Address,

    City,

    Customer,

    ContactName,

    Country,

    Fax,

    Phone,

    PostalCode,

    "world.Name";

SQL SELECT *

FROM SalesDB.dbo.Customers;

As you can see here I have named the table CustomersTable. If I did not have this line (including : ) then the table name of Customers taken from the SQL table would be used.

I believe this answers your question. If this does, please mark this as helpful and correct.

Thanks,

Mark James

Qlik

Not applicable
Author

Hey Mark

I've did what you have said, and my code can be seen below

//Partners:

SQL Select

Partner.name

FROM FilteredAccount as Partner;

Here, my aim was, to rename FilteredAccount to Partner. I've also commented out the "qlikview name" with ':'. If I Reload the script, then if I want to create a table box, and searching tables on the "New Table Box" frame the "Show system tables", I don't see a table with the name Partner. I only see a table with the name FilteredAccount.

So -it seems like , for me- renaming tables this way do not work in QlikView.

BR

Tibor

marcus_sommer

Like above described this won't work - you need to name your tables explicitly within the qlikview-part not within the sql-part.

Further by many sql-tables might be a rename-statement per mapping helpful.

- Marcus

Not applicable
Author

Yeah, than the only way to rename is in the QlikView part......

Thanks guys for the comments and the help, I really appreciate it.

Best regards,

Tibor