Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can we join two tables from two different databases on two different servers in script?

Hi All

I have a requirement where we need to get data from two tables which reside in two databases on different servers

As we can have only one connection active at a time, I couldnt figure out how to join those two tables.

I have come to know that we can use Servername.databasename.schema.tablename in the join syntax

But the tablename is something like dbo.tablename

So when I use the syntax as Servername.databasename.schema.dbo.tablename am getting an error like "Only 3 prefixes are allowed".

"dbo dot"is actually a part of tablename whereas Qlikview is interpreting it as a prefix

I dont know whether this process is correct or not..and can we actually join two tables from two databases from two different servers?

Someone please help me out

Thanks

Priya

1 Solution

Accepted Solutions
gandalfgray
Specialist II

Hi Priya

Sure you can join two tables from different databases/servers.

Connect ... // Connect to the first database/server

Table1:

Load ...

Select ...

From (table in first database); // here you will need at most schema.dbo.tablename (leave out the servername.databasename)

Connect ... // Connect to the second database/server

Left Join (Table1)

Load ...

Select ...

From (table in second database);

Try this out

/gg

View solution in original post

3 Replies
gandalfgray
Specialist II

Hi Priya

Sure you can join two tables from different databases/servers.

Connect ... // Connect to the first database/server

Table1:

Load ...

Select ...

From (table in first database); // here you will need at most schema.dbo.tablename (leave out the servername.databasename)

Connect ... // Connect to the second database/server

Left Join (Table1)

Load ...

Select ...

From (table in second database);

Try this out

/gg

its_anandrjs

Hi,

As my understanding why not you create a DVD of the dbo connection and then join the tables after creating the qvd it is more easy and right way to use your servers file and safe also.

HTH

Regards

Anand

Not applicable
Author

Priya,

If you want to join tables inside QlikView you should load first table, and then load with join second table.

Example:

CONNECT [connection string to server1]

Tab1:

SELECT *

FROM ....;

CONNECT [connection string to server2]

Tab2:

JOIN (Tab1) SELECT *

FROM ....;

Joined fields must have the same names for the example above.