Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar423
Contributor III
Contributor III

Create Multiple Qvds Using Single Store Statement

Hi All

I loaded 5 tables,and now i want to create 5 qvds with single store statement and i want to drop the tables at a time.

So, i used the below code for this

FOR i =0 to NoOfTables()-1

LET vTabName =TableName($(i));

STORE $(vTabName) into $(vTabName).qvd (qvd);

DROP Table $(vTabName);

NEXT i

but i'm unable to create the qvd 2nd table and 4th table and i'm gettinng an error.When i start debugging loop is stepping from 1st table to 3rd table and next 5th table and next getting an error

Syntax error, missing/misplaced FROM:

STORE  into .qvd (qvd)

STORE  into .qvd (qvd).

Thanks in Advance

Sridhar.

1 Solution

Accepted Solutions
rubenmarin

Hi Sridhar, you can use:

FOR i =0 to NoOfTables()-1

LET vTabName =TableName(0);

STORE $(vTabName) into $(vTabName).qvd (qvd);

DROP Table $(vTabName);

NEXT i

When you drop the table, the index of the other tables changes, so you always need to get the (0) table until all are droped.

View solution in original post

7 Replies
rubenmarin

Hi Sridhar, you can use:

FOR i =0 to NoOfTables()-1

LET vTabName =TableName(0);

STORE $(vTabName) into $(vTabName).qvd (qvd);

DROP Table $(vTabName);

NEXT i

When you drop the table, the index of the other tables changes, so you always need to get the (0) table until all are droped.

Not applicable

This works, you would need to define the table names (in my case they are 'ASCII', 'Transactions', 'Characters')

FOR Each vTable IN 'ASCII', 'Transactions', 'Characters'

STORE $(vTable) INTO $(vTable).qvd (QVD);

DROP Table $(vTable);

NEXT

You can also create a subroutine and call the subroutine to store and drop the QVD.

SUB Create_QVD

  STORE '$(vTable)' INTO QVD\$(vTable) (qvd) ;

  DROP TABLE $(vTable);

END SUB

sridhar423
Contributor III
Contributor III
Author

Thanks Ruben Marin its working.

amit_saini
Master III
Master III

Sridhar,

If you want to store multiple tables then you have store it in multiple QVD files.  You can store in QVD files using like this

STORE Table1 INTO Table1.qvd;

STORE Table2 INTO Table2.qvd;

STORE Table3 INTO Table3.qvd;

'

'

'

'

STORE Tablen INTO Tablen.qvd;

Or you can use For loop to store all tables in QVDs like below


FOR vCount = 0 to NoOfTables()-1

     LET vTableName = TableName($(vCount));

     STORE $(vTableName ) INTO $(vTableName).qvd (qvd);

NEXT vCount

Thanks,

AS

vireshkolagimat
Creator III
Creator III

Hi, I am loading the 3 csv files and trying to store all the 3  csv files as QVD. But the script is generating one qvd file which contains the data from all the 3 csv files. What if i need individual qvd for each file.

Thanks

Viresh

rubenmarin

This can be caused because your 3 loads have the same structure and is autoconcatenating. To avoid this you can use the 'NoConcatenate' clause:

LOAD... FROM csv1

NoConcatenate LOAD ... FROM csv2

vireshkolagimat
Creator III
Creator III

Thank you. Its working file.