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

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

9 Replies
buzzy996
Master II
Master II

try some thing like,

tab:

SELECT *
FROM sys.Tables;


store tab into qvdpath\alltables.qvd;

effinty2112
Master
Master

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

Anonymous
Not applicable
Author

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
Master II
Master II

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

Anonymous
Not applicable
Author

yes shiva reddy...

jagan
Luminary Alumni
Luminary Alumni

Hi,

Check this link

Load all tables in database dynamically

Regards,

Jagan.

buzzy996
Master II
Master II

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

Anonymous
Not applicable
Author

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

jagan
Luminary Alumni
Luminary Alumni

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.