Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
sivaprakash_t
New Contributor

how to pull all the tables at a time from database

Hi Guys,

Can any one plz tell how to pull all the tables from database at a time and convert into QVD. PFA,for details about database details.

please provide script for this database.

Untitled.jpg

Tags (1)
9 Replies
buzzy996
Honored Contributor II

Re: how to pull all the tables at a time from database

try some thing like,

tab:

SELECT *
FROM sys.Tables;


store tab into qvdpath\alltables.qvd;

effinty2112
Honored Contributor

Re: how to pull all the tables at a time from database

Hi Siva,

Something like

TableNames:

SQL SELECT NAME

FROM SYSTABLES;

Will give you a resident table giving you all the table names in your database. If you want to save the tables to qvd you will need to loop through the tablenames and create a qvd for each one  - a qvd holds one table only.

This script to loop through the tablenames could be like below. I haven't tested this and wrote it in a hurry so I suggest caution - start off with For i =1 to 1 or some other low number. It gives the gist of how to do it.

For i = 1 to NoOfRows('TableNames')

Let TN = Peek('NAME',$(i),'TableNames');

[$(TN)]:

LOAD*;

SQL SELECT *

FROM $(TN);

STORE [$(TN)] into $(TN).qvd (qvd);

Next

sivaprakash_t
New Contributor

Re: how to pull all the tables at a time from database

Hi Bro,

i'm getting this kind of error....and my code and error is attached...Please help me out of these problem...Capture1.JPGCapture.JPG

buzzy996
Honored Contributor II

Re: how to pull all the tables at a time from database

are u created dsn connection for this ans using the same to fetch the data?

sivaprakash_t
New Contributor

Re: how to pull all the tables at a time from database

yes shiva reddy...

MVP
MVP

Re: how to pull all the tables at a time from database

Hi,

Check this link

Load all tables in database dynamically

Regards,

Jagan.

buzzy996
Honored Contributor II

Re: how to pull all the tables at a time from database

i think jagan already shared good one,hope that helps else let me know we can see...

sivaprakash_t
New Contributor

Re: how to pull all the tables at a time from database

I'm tried with that,the thing is here i don't have Information schema.columns .so that it throws an error

MVP
MVP

Re: how to pull all the tables at a time from database

Hi,

Information schema.columns is for MS SQL Server database, you can replace that with the euqivalent table in the corresponding database. 


For oracle ALL_TABLES   ALL_TABLES

For MYSQL - all_tables or SHOW_TABLES


How to List All Tables and Describe Tables in Oracle, MySQL, DB2 and PostgreSQL | OneWebSQL


MySQL :: MySQL 5.7 Reference Manual :: 13.7.5.37 SHOW TABLES Syntax


What is the database you are using?


Regards,

Jagan.

Community Browser